Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vrinek502

macrumors newbie
Original poster
Mar 2, 2006
5
0
Greece, Thessaloniki
What I'm trying here is to append the timestamp to a text file every minute. This would be useful to tracking time and date of sleeping (for battery life measurement) and for not letting the disk to sleep (major problem with externals while editing video, getting a cup of coffee and waiting 30secs for spin up).
I know it can be done with a simple shell script, but I don't know how (not much previous Unix experience).

This is roughly what I try to do:
Code:
get current date (in format yyyyMMdd.hhmmss)
append it (add it to the end) to the file stamp.log in the working directory
exit

Can somebody help me?
 

zimv20

macrumors 601
Jul 18, 2002
4,402
11
toronto
Code:
#!/bin/sh

LOGFILE=<however you get the name of your logfile>

date "+%Y%m%d.%H%M%S" >> $LOGFILE
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.