Arduino Yun not connect to server

Hi

I have a problem with my arduino yun, try to connect to a server and write values ??in a database, and I have done this with the ethernet shield and it works fine, but when I adapt the code to make it work with the arduino Yun connects only the first time and when I reconnect my arduino yun to the power supply (5V, 1A) does not connect to the server.
Thanks, bye.

Code:

#include <Bridge.h>
#include <YunClient.h>

YunClient client;

IPAddress server(0,0,0,0); 
long interval = 60000; // Wait between dumps
double time;
int led = 13;

void setup() {
  // Bridge takes about two seconds to start up
  // it can be helpful to use the on-board LED
  // as an indicator for when it has initialized
  pinMode(13, OUTPUT);
  digitalWrite(led,LOW);
  
  Bridge.begin();

  Serial.begin(9600);

  while (!Serial); // wait for a serial connection
}

void loop() 
{
  time=(millis()/1000);
  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    digitalWrite(led,HIGH);
    Serial.println("Connected");
    Serial.print("time: ");
    Serial.println(time);
    Serial.println("");
    // Make a HTTP request:
    client.print( "GET /arduino.php?");
    client.print("Device=");
    client.print( "Mega_2560" );
    client.print("&&");
    client.print("time=");
    client.print(time);
    client.println( " HTTP/1.1");
    client.print( "Host: " );
    client.println(server);
    client.println( "Connection: close" );
    client.println();
    
  }
  else {
    // you didn't get a connection to the server:
    Serial.println("Connection failed");
    digitalWrite(led,LOW);
  }
  
  client.stop();
  client.flush();
  delay(interval);

}
while (!Serial); // wait for a serial connection

Your sketch demands that you open serial monitor before it can start. Remove that line and re-upload

Thanks Federico

I removed that line and arduino yun connects to server even when I reconnect the power supply. Thank you very much. ;)