Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-17-2012, 12:48 AM   #1
Registered: Aug 2011
Distribution: Ubuntu, Fedora
Posts: 175

Rep: Reputation: 9
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
Old 03-17-2012, 02:02 AM   #2
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
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.
1 members found this post helpful.
Old 03-17-2012, 03:13 PM   #3
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
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:

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.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can backup a remote server(only folder needed) with ftp ,daily backup? ahjafari Linux - Newbie 1 10-26-2011 05:04 PM
Newbie trying to write a simple backup script to backup a single folder Nd for school stryker759a Linux - Newbie 2 09-16-2009 09:52 AM
LXer: Automatic backup for sporadically connected clients with Box Backup LXer Syndicated Linux News 0 08-29-2008 09:40 PM
Chosing a folder for automatic subscription JZL240I-U LQ Suggestions & Feedback 10 11-23-2006 11:46 AM
Automatic deletion of spam folder? RKris Linux - General 1 05-27-2003 09:21 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration