Page 1 of 1

cron backup job

Posted: 05 Jul 2012, 15:58
by LudwigVan
Hi,

I want to run a script every evening by cron saving some folders in the home drive to an external drive as described in the wiki http://wiki.excito.org/wiki/index.php/B ... sing_Rsync.

Which crontab I should edit?

I would use nano for editing.

L.

Re: cron backup job

Posted: 05 Jul 2012, 17:11
by Puma
Hello Ludwig,

Why use Rsync? you can use the backup feature within the bubba interface.
Or you can run a script with cron to create a regular copy or tar to the external drive.


Puma

Re: cron backup job

Posted: 06 Jul 2012, 04:33
by Gordon
Use the crontab of the user that is allowed full access to the folders that you want to backup. Or, the user that is allowed to do 'sudo rsync'...

This may be stating the obvious, but to edit a crontab: use crontab (with '-e'). This does implement nano on the B3 by the way, so nothing mystic there.

Re: cron backup job

Posted: 07 Jul 2012, 07:36
by nobody
If there are multiple owners included in the backupset, AND you want to maintain and remember that ownership, only running the cronjob as root will suffice.

Re: cron backup job

Posted: 07 Jul 2012, 10:20
by gonk
Puma wrote:Why use Rsync? you can use the backup feature within the bubba interface.
There are different needs.

The backup function in bubba lets you go back to the time from which you wish to restore a file but it uses a not-very-human-friendly format. My initlai backup created some 48000 five megabyte .difftar.gz files.

In other cases you might wish to just keep and update a snapshot of the current contents of certain folders at another location, either a local external drive or remote server. That's where rsync outsmarts and outperforms the backup function in bubba.

Here's my rsync script used to keep a secondary mirror of the music, pictures and video folders.

Code: Select all

rsync --archive --acls --delete-delay --verbose --stats --itemize-changes --progress --human-readable   /home/storage/music /home/storage/pictures /home/storage/video   /home/storage/extern/usb-mybook/B3_backup/media_folders/

Re: cron backup job

Posted: 08 Jul 2012, 15:21
by LudwigVan
Dear all,

thanks for the answers. However, my question was not included. I think I know how to use nano. And usually I log in to my B2 every week via ssh and perform rsync as su manually for different folders, which also include user folders. I want to let this be done by a script and cron. rsync performes nicely for me, so I agree with gonk.

So here are my questions:

- Which crontab should I edit (I learned there are different ones on bubba)?
- What should I include in the script so it is run as su and saves all data as described above?
- Something else to know?

thx,

L.

Re: cron backup job

Posted: 08 Jul 2012, 16:49
by Gordon
Every user (including root) has it´s own crontab and as a rule the smart money is to not do it as root. In the case of using rsync for system backup, root rights will however be required - hence the need for sudo if the backup job is started by any other user then root itself (e.g. when remotely triggered through ssh). To edit a crontab, logon as the user to which that crontab belongs (or `su` to become that user) and issue `crontab -e`; that's all there is to it.