If you have the disk space available I would suggest using the tar comamand. Other devices can also be used of course, if available. For instance if you wanted to backup the /etc dirctory every night at midnight. Add a line in cron using "crontab -e"
0 0 * * * /bin/tar -czf /etcbackup.tar.gz /etc 1>/dev/null 2>/dev/null
At 0 minutes and 0 hours each day /bin/tar will execute and backup the /etc directory tree and put it in the file /etcbackup.tar.gz.
To view the output file use:
tar -tzvf /etcbackup.tar.gz
The example would only work for root crontab becaue only root can write to the top level directory. If a normal user, then create directory like /backups and give full permission to it for the user. I think you could modify as required for your desired application.
|