>On Mon, 29 Oct 2001 18:14:18 +0100, Didier Wiroth staggered into the
>Black Sun and said:
>>I would like to backup daily a directory called /var/CommuniGate (the file
>>permissions and user/group/owner info should stay)
>>tar -cvf CommuniGate.tar /var/CommuniGate | gzip CommuniGate.tar
>>but I would like to do it automatically and 7 days a week (this is not
>>a problem). The file "CommuniGate.tar.gz" created on Monday should be
>>called Monday.tar.gz, the file from Tuesday should be called
>>Tuesday.tar.gz etc... How can you do that in a shell script.
>tar czf /tmp/communigate.tgz /var/communigate
>DAY=`date +'%A' `
>mv -f /tmp/communigate.tgz /somewhere/$DAY.tgz
>Run that from cron, probably not at 12:00 midnight, but 12:01 would be
Make sure that another cron job is not running at the same time
( not a big problem, but it may make a mess of your archive ).
You can also do things differently, labeling the archives by the exact
date ( rather than Monday ). Possibly it would work better that way if
you have a tape drive automatically backup from the partition where
you store your archives. If you only want the last week archives still
stored on the drive then use logrotate to clean it up.