View Single Post
  #2 (permalink)  
Old 30-11-2009, 08:42 PM
jaysunn's Avatar
jaysunn jaysunn is offline
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 602
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

Hello,

You can try something like this at the top of your script.


PHP Code:
#!/bin/bash

# define the log location.
LOGFILE=/var/log/date_check_log

# execute date command when script is run.  This will continue to write the 
# date each time the script is run to the last line of the log file.
/bin/date >> $LOGFILE

# Then tail the log for the last line of the file when the script was run.

/bin/tail -n1 /var/log/date_check_log

# The above should print this output to stndout.  If you want to capture it in
# a file just define another log file and redirect output to it with >>. 
Not sure it this helps.

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote