Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

cron backup job

Got problems with your B2 or B3? Share and get helped!
Post Reply
LudwigVan
Posts: 50
Joined: 20 Aug 2009, 01:17

cron backup job

Post 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.
Puma
Posts: 230
Joined: 29 Sep 2008, 06:30

Re: cron backup job

Post 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
Linux is like a wigwam - no windows, no gates, apache inside!
Gordon
Posts: 1470
Joined: 10 Aug 2011, 03:18

Re: cron backup job

Post 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.
nobody
Posts: 226
Joined: 10 Mar 2012, 14:46

Re: cron backup job

Post 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.
gonk
Posts: 93
Joined: 30 May 2012, 01:53

Re: cron backup job

Post 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/
LudwigVan
Posts: 50
Joined: 20 Aug 2009, 01:17

Re: cron backup job

Post 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.
Gordon
Posts: 1470
Joined: 10 Aug 2011, 03:18

Re: cron backup job

Post 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.
Post Reply