On Thu, 05 Mar 2009 21:49:41 +0100, Kevin Keane <subscript...@kkeane.com> wrote:
> Funny you say that. Yes, your version is shorted and will work. I > actually used to have it that way. > > The reason I changed to the longer version is that now the schedule file > is generated by a script, it's basically a simple for loop that > generates it. One thing this lets me do is easily generate different > scheduled so that the full backups are staggered for different clients, > and the differentials always happen 7 days after the fulls. Hehe, I think lots of people reinvent that wheel, I also wrote a little bash oneliner to stagger schedules over days/weeks: i=0; for srv in $(cat /tmp/servers.txt); do let i++; let j=(i-1)/7+1; let k=($j-1)*7; let dayno=$i-$k; let p=($j-1)/4; let q=$p*4; let weekno=$j-$q; let tmp=8-$dayno; mainday=$(date +%a --date="$tmp day ago" | sed -r 's/(.*)/\L\1\E/'); let tmp=7-$dayno; firstday=$(date +%a --date="$tmp day ago" | sed -r 's/(.*)/\L\1\E/'); let tmp=9-$dayno; lastday=$(date +%a --date="$tmp day ago" | sed -r 's/(.*)/\L\1\E/'); case $weekno in 1) fullweek="1st"; diffweek="2nd-5th";; 2) fullweek="2nd"; diffweek="3rd-1st";; 3) fullweek="3rd"; diffweek="4th-2nd";; 4) fullweek="4th"; diffweek="5th-3rd";; esac; sed -i "s+HOSTNAME+$srv+;s+Full 1st fri+Full $fullweek $mainday+;s+2nd-5th fri+$diffweek $mainday+;s+sat-thu+$firstday-$lastday+" schedules/$srv.schedule; done /tmp/servers.txt has a hostname on each line, and I include schedules using the @/etc/bacula/schedules/hostname.schedule format in bacula-dir.conf. The above expects existing dummy schedule files containing 'HOSTNAME', 'Full 1st fri' etc. strings, see the sed stuff, this can be created easily with another for loop copying a sample file. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users