script only running if serial port open?

I recently added a time output to my script - it counts up how long it has been running - so every minute it will output something like this:

00:00:00 ... message ... 00:01:00 ... message ... 00:02:00 ... message ...

and so on.

I found that even after the board has been powered up for a long time, if I open the serial monitor and check the output, I see 00:00:00 !

Yet, the program should be running even if the serial port is open?

Opening the serial monitor resets the Arduino. It's a feature.

You can permanently disable that feature by cutting a trace on the Arduino, but then it becomes more challenging to upload sketches.

If I open the serial port via hyperterminal does it also reset? I was hoping to be able to track time and other variables within the arduino, but the computer might be off. At some point boot up, open the serial port and look at what the data is...

At some point boot up, open the serial port and look at what the data is...

That will normally cause your Arduino to reset and the sketch program to start from scratch, as it's the default nature of the PC application/FTDI driver/and Arduino board wiring design.

There are tons of postings on this subject as well as various ways to defeat this behavior, search on auto-reset.

Lefty