Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a date stamp.

Status
Not open for further replies.

sirrom

Technical User
Jul 11, 2001
80
GB
I have written this script to run a system back up every night.
It outputs to a log. What do I need to add to the script so it gives me a date & time stamp every time the back up has completed.
Thanks in advance.

#!/usr/bin/ksh

LOGFILE=/mydir/newlog

# Rewind the tape
mt -f /dev/rmt1.1 rewind

# Do the backup
for x in / /usr /var /home
do
echo "Backing Up $x" >> $LOGFILE
backup -0 -u -f /dev/rmt1.1 $x
done

# End Message
echo "Backup Completed" >> $LOGFILE

# THE END
 
Just change your echo "Backup Completed" >> $LOGFILE
to:

echo 'Backup completed on '`date`

Note that the ` character around the date command can usually be found above the tab key - it is not a normal apostrophe. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top