LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Backing-up a folder (https://www.linuxquestions.org/questions/slackware-14/backing-up-a-folder-30450/)

esael 09-15-2002 09:08 PM

Backing-up a folder
 
Hi,

If I want to back up a folder every midnight, how can I do it?

Esael

Excalibur 09-15-2002 11:09 PM

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.


All times are GMT -5. The time now is 03:26 AM.