These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Backups at alternating weeks on the new forum.
Hi there
I want to setup the following backup strategy: - every day of the week an incremental backup (easy to setup) - two alternating full backups at the end of the week. In case a full backup fails, I still got the one of the previous week (including the daily ones). The problem is, that the days within the month will change. Is there a trick to let virtualmin do the job (e.g. manually edit cronjobs)?
Yeah, running a cron job every other weekend is tricky :-)
It would probably be simplest to manually edit the cron file to add in the appropriate cron schedule -- so setup your backup schedule just for weekly or whatever, edit /var/spool/cron/crontab/root, and change it to use something like this:
00 02 1-7,15-21 * Sat /etc/webmin/virtual-server/backup.pl ...
The above says to run Virtualmin's backup.pl at 2:00am on Saturday, when the day of the month is 1-7, and then again when it's 15-21.
It's not entirely pretty, but that will essentially run every other week on the weekend :-)
-Eric
Hi Eric
Thanks for your solution. But what about the days 28-31?
After some googleing I came up with the following solution:[ul]
[li]Setting up two jobs that run every week[/li][li]In the field "Command to run before backup" I put the expression [[ $(expr `date +%W` % 2) = 0 ]] (returns 1 for even weeks)[/li][li]In the field of the 2nd job the expression is evaluated against 1 (instead of 0)[/li]
[/ul]This way there's no need to poke around in files that may be overwritten by Virtualmin. Haven't tested it yet but hope that it works.
Yeah, mine was kind of hacky. Nice find you have there, thanks for posting it!
-Eric