Rsnapshot automatic backups with link_desk and sync_first

1.2k Views Asked by At

My .conf file:

link_desk 1
sync_first 1

I'm using cron to do interval backups.

0  *  * * *     rsnapshot sync
10 *  * * *     rsnapshot hourly
30 3  * * *     rsnapshot daily
0  3  * * 1     rsnapshot weekly
30 2  1 * *     rsnapshot monthly

It's confusing me and i do not know if its right. Maybe I should do sync before every cronjob or just before smallest interval?

In the future i want run another backup with rsnapshot with seperate config file (for windwos machine).For example:

0  *  * * *     rsnapshot -c windows.conf sync
10 *  * * *     rsnapshot -c windows.conf hourly
30 3  * * *     rsnapshot -c windows.conf daily
0  3  * * 1     rsnapshot -c windows.conf weekly
30 2  1 * *     rsnapshot -c windows.conf monthly

.pid files I can separate in config file. Would I still have incompatibility issues with parallel running two rsnapshot process?

And the last question how could I organize cronjobs? what if my sync process takes longer than coming backup command? Is it possible to run rsnapshot hourly just after rsnapshot sync?

1

There are 1 best solutions below

2
On

rsnapshot ran with sync_first enabled is designed for you to run one sync command then one or more of the interval commands as is time appropriate. Running sync before every cron job defeats the use of sync_first. You should run sync just before your smallest interval.

As far as organizing your cronjob, the only ordering that is critical is between the sync and hourly. daily will just use the oldest hourly available for its newest daily.0, weekly the oldest daily etc. hourly though, expects a .sync directory from which to create its new hourly.0. If daily runs before hourly it will take the 1:00 AM rather than the 2:00 AM hourly backup which gives you nearly, but not exactly, the same backup coverage. You'll need to decide if that's critical for your situation.

When faced with your question I created a small script file that ran rsnapshot sync followed by rsnapshot hourly and scheduled that in cron.

I have no experience running snapshots in parallel. As long as you are backing up to different directories I predict no issues beyond CPU and network usage. It will be like starting a second rsync command by hand before a previous one completes.