Results 1 to 4 of 4
I'm trying to make a backup script that will create a directory with the date and then copy the files to that new date directory and then create a tar ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-06-2006 #1
- Join Date
- Mar 2006
backup script help
cp -r /home/www/* /backups/%date%
tar -cvzf /backups/%date%.tar.gz /backups/%date%/
- 09-06-2006 #2
You probably want to capture the output of the 'date' command into a variable, and use it repeatedly. The 'date' command reports the time and date including seconds, so its output changes frequently, so its not just a convenience to call it once, but a necessity.
You can change the format of the time and date reported by 'date' with command line flags.Linux user #126863 - see http://linuxcounter.net/
- 09-06-2006 #3
There is so many threads on that subject, I'm sure you can find something interesting in one of them.
Like this one for example :
http://www.linuxforums.org/forum/lin...t-newbies.html"To express yourself in freedom, you must die to everything of yesterday. From the 'old', you derive security; from the 'new', you gain the flow."
- 09-08-2006 #4
Unless there is a reason (like rapidly changing data files), I wouldn't copy everything and then tar it, I would just tar it in place.
For example, today this would create file /backups/www090806.tar.gz which backs up all files in /home/www.
tar -cvzf /backups/www$(date +%m%d%y).tar.gz /home/www