Special CRON for backups

I would like to schedule a backup to be executed the first sunday of each month … I found many ressources about this that cannot be done using the Virtualmin interface.
For example my CRON should be something like:

0 3 * * sun [ $(date +%d) -le 07 ] && /root/test.sh

The script test.sh is executed at 3AM only if the date is a sunday and date is less or equal to seven (so it’s the first sunday) … How would I enter this using Virtualmin, the complex schedule in backups does not seem to allow for this … I tried looking for the backup cron jobs but they do not seem to be at the usual place for Cron, or maybe I didn’t recognize them :slight_smile:

If that “just” triggers a script, why dont you put it into crantab then?

The complex schedule does allow that. I have some backups running in virtualmin scheduled for the first Saturday of the month.
Ctrl click to highlight dates 1-7, then highlight Sunday only.

@scotwnw : it seems that you are right … I spent almost 2 hours searching the internet and everywhere I read that the crontab could not do it natively (ie without the kind of formula I mentionned in my original post) so I assumed that it was not possible within Virtualmin, seems I was wrong :frowning:
Thanks for answer, I will test, … well I’ll do it and check the first sunday of may !
Thanks again !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.