Chuck Amadi Systems Administrator wrote:
Hi allI would like comments on this solution to run fortnight daily backup using 10 tapes. and on the last Friday of the month to run a Monthly backup for archiving purposes and pull out of System until the following year. I have hacked up two scripts from the this list. First of all here is mt cronjob:: I need to know what tape is in the current tape drive be it the usual daily tape and of course if it happened to be the last friday in the month or say a monday I will to put the next daily tape or on the thursday before the last friday of the month backup to be ready to put the next monthly tape in. I am aware the amdump send a report on failures or successful backups but if a daily schedule is run and it's going to be a last friday and I putin daily tape does the script ignore the daily tape and amdump monthly report So andthus I can say on monday put in the monthly tape and run amflush. Cheers # Check which Amanda tape if Daily or Monthly. 0 14 * * 1-5 /usr/sbin/check_amanda_tape.sh 45 19 * * 1-5 /usr/sbin/last_friday_month.sh
I'm not certain at what times you are awake or asleep, but running amcheck at a qarter past midnight is a strange time. Why not run it at e.g. 16:45, so that you already have inserted the tape in the day, and amcheck is the safety line to verify if you inserted the correct one. Or may be run amcheck twice: once to tell you which tape is expected (ok, 0:45 is fine, but 7:45, just before arriving at the office, is better -- the backupjob started at 19:45 the evening before might still be busy at 0:14) and another amcheck a little before leaving as safety measure that you inserted indeed the right tape.
Here is the Last Friday In Month script (last_friday_month.sh). #!/bin/sh # Script last_friday_month.sh # chmod 755 # Amdump - Last friday of the month script to check prior to running usual daily tape # or the monthly tape backup. # Ensure the in the amamda.conf file the within the dumptype# paramter for root-tar that record is set to no # example - record no This is to stop Monthly ruining the DailySchedule. # Summarisation of the script # cal - prints month calendar # awk - selects friday column date # tail - last date # -eq - date compared last date with todays date.
It's not critical of course, but I would correct the spelling and grammar errors in the comments too. Besides that, the name of the script is bizar too: is does not run "only on friday", as the name would suggest, but it runs always, but does different things on some days. Why not name it "amanda_backup.sh" ?
if [ `cal | awk 'NF >= 6 {print $6}' | tail -1` -eq `date +%d` ]
then su -c "/usr/sbin/amdump MonthlySet"
else su -c "/usr/sbin/amdump DailySet1"
fi
Do not run amdump as root, run as it amanda, i.e. remove the "su" command, and use amanda's crontab to run the shell script. -- Paul Bijnens, Xplanation Tel +32 16 397.511 Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512 http://www.xplanation.com/ email: [EMAIL PROTECTED] *********************************************************************** * I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, ^^, * * F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, * * stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, * * PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, * * init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... * * ... "Are you sure?" ... YES ... Phew ... I'm out * ***********************************************************************
