LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   automatic backup a folder (https://www.linuxquestions.org/questions/linux-newbie-8/automatic-backup-a-folder-934878/)

ac_kumar 03-16-2012 11:48 PM

automatic backup a folder
 
Hi i want to make script that automatically start and take a backup of a particular folder.
to backup folder1
path folder2

gdejonge 03-17-2012 01:02 AM

Most distro's have crontab configured to run scripts in the /etc/cron.* directories at the correct time, like every hour,day or week.

So if you want to backup a directory every day, you would put your backup script in the directory /etc/cron.daily

for the command in the script file to make the actually backup I would advice to checkout rsync. It should have come with your distro.

lleb 03-17-2012 02:13 PM

have you created a script that will backup the directory to the destination you desire in the way you want to back it up? if so then as user you can create a crontab -e (the -e = edit) and put in something like this:

Code:

0    21    *    *    *    /path/to/script
that would run nightly at 9pm local.

you might have to give the user permissions to run its own cronjob by adding the user name to /etc/cron.allow or were ever that file is located on your distro.

what gdejonge said about rsync is great, but keep in mind that has to be run as root. if you just want to cp, not as clean as rsync mind you, or tar the directory to save space then user rights are just fine.


All times are GMT -5. The time now is 11:06 AM.