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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup Log need date and time to be displayed in logfile

Status
Not open for further replies.

GuruNS

Technical User
Oct 24, 2002
5
GB
tar -cvf /dev/rmt/tps4d5 ./Directory_Name >& logfile

The above make backup of directory_name and redirects the data being backed up to a logfile. However I would like the log file to also display the date,time of when each file was backed up and this should be displayed in the log file.

Can anyone let me know if the command below will work or do i need to make changes if so what changed do i need.

tar -cvf /dev/rmt/tps4d5 (date; ./Directory_Name) >& logfile

any help is much appreciated
 
If you want to tar current directory to a tar file called /dev/rmt/tps4d5 then
tar -cvf /dev/rmt/tps4d5 `pwd`;(echo "Dir " `pwd` " Date " `date`) > logg

HTH ;-) Dickie Bird

Honi soit qui mal y pense
 
Dickie Bird the tar -cvf /dev/rmt/tps4d5nrv is the tape drive. the current directory is ./Directory_Name) I just require the time and date to be displayed in the logfile.
 
Which is what tar -cvf /dev/rmt/tps4d5 `pwd`;(echo "Dir " `pwd` " Date " `date`) > logg will do

tar -cvf :create a tar file (OR taped tar file)

`pwd` :list all current directory files and write them to tar file

; equiv to newline

echo the Directory name and current directory name to a new file called logg (or append to it with >> )

;-)

Dickie Bird

Honi soit qui mal y pense
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top