I'm trying to write a small backupscript which should get executed every hour via cronjob.
While the script does monthly/weekly/daily backups and these work, i also would like to perform hourly backups - but only on specific hours. (Like i have a cluster of 3 nodes and want to perform the backup every hour on a different node).
Right now, i want to perform the hourly backups on the following hours
BACKUP_HOURLY=true
BACKUP_RETENTION_HOURS=2,5,8,11,14,17,20,23
And I'm checking for current hour via
HOUR=`date +%H`
I tried something like
if [[ ( $BACKUP_HOURLY == true ) && ( $HOUR -eq $BACKUP_RETENTION_HOURS ) ]]; then
/usr/local/bin/backup
fi
But this doesn't seem to work. While I also tried googling for a solution I'm probably unable to match the correct search terms to find an easy solution to this problem. Hope anyone can help :-)