He is my previous Boss hack if you look at the third script would it be
a simple process to just add amanda amcheck and amdump after the first
two scripts have confirmed the true date being a daily or monthly backup.
Or would you suggest to keep it simple use paul bijnens script .
Please note I would prefer to still run amcheck prior to amdump
Thanks all. I am looking at ideas prior to startig my hack in work 2 mory.
------ ---------- First part of script -----------------------------
#!/bin/sh
# script name dobackup.sh
# takes 1 arugument - monthly or daily
# script to run backup program
/path/to/program/backup.sh $1 2>&1 | /usr/bin/tee /path/to/backup-org/
'/bin/date +"%Y-%m-%d"'
-------------------------- End of Script
------------------------------------------
----------------------------- Second part of script
---------------------------------
#!/bin/sh
# scirpt name today_is_last_friday.sh
# Run this shell on a friday to check if it is the last friday in the month.
# used for backup system to run monthly backup on last friday in the
month, daily otherwise.
DATEPROG=/bin/date
# exits with true (0) if it is the last friday, otherwise with 1
# Get the month for this friday
thisfri='$DATEPROG --date="this friday" "+%B" '
# Get the month for next friday
nextfri='$DATEPROG --date="next friday" "+%B" '
# now compare them - if different, today is the last friday in the month
if [ "$thisfri" != "$nextfri" ]
then
# echo "Today is the last friday of the month ! "
exit 0
else
# echo "Today is NOT the last friday of the month ! "
exit 1
fi
------------------------------End of
script----------------------------------------
------------------------------- Last script
----------------------------------------
#!/bin/sh
# shell script to run on fridays to check if it's the last friday in
the month
# if so, do a complete monthly backup, otherwise do a usually daily backup.
cd /path/to/program
if ./today_is_last_friday.sh
then
# Thus could I run su - c "/usr/sbin/amcheck
MonthlySet1";su - c "/usr/sbin/amdump MonthlySet1";
echo " Starting MonthlySet1 Backup"
/path/to/prgram/backup.sh monthly
else
# Thus could I run su - c "/usr/sbin/amcheck DailySet1";su
- c "/usr/sbin/amdump DailySet1";
echo " Starting DailySet1 Backup"
/path/to/prgram/backup.sh monthly
fi
--------------------------------------- end of script
---------------------------------------------------------------------
|