How to successfully reset Arduino Yun

Hi there.
I have a sketch running successfully in arduino yun , bu when I unplug the USB from my PC and plug it to a USB power adapter, It turns on, but it never starts the program sketch.
I noticed that the sketch starts only if I run the Serial Monitor on Arduino 1.5 platform.

How can I successfully reset Arduino Yun like when we unplug/plug Arduino UNO??


Just found out that this caused my problem.

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

So when I need to run arduino, without debugging, I have to use this.

 int debug_mode=0;
if (debug_mode==1) {
      while (!Serial); // wait for a serial connection