# Daily archive script. There will be scripts for weekly and monthly too. # Get the day name today=`date +%A` # Create todays snapshot archive. for i in tex py ipynb DAT geo; do # create, verbose, bzip2, filename follows: find /home/me -name '*.$i' | tar cjvf /mnt/arc/$today$i.tar.bz2 --files-from - > /mnt/arc/$today.log; done
bin/weeklyArchive:
# Get the week number today=`date +%A` weekNumber=`date +%V` # Tar todays snapshot archives into an archive # called this week number. Call this after the # weekly archive has completed. tar xvf /mnt/arc/$weeknumber.tar /mnt/arc/$today* > /mnt/arc/week$weekNumber$today.log
bin/monthlyArchive:
# Monthly archive script. There will be scripts for daily and weekly too. # Get the week number today=`date +%A` weekNumber=`date +%V` monthName=`date +%B` # Tar todays snapshot archives into an archive # called this month name. Call this after the # weekly archive has completed. tar xvf /mnt/arc/$monthName.tar /mnt/arc/$today* > /mnt/arc/$monthName.log
Do, $ crontab -e and update to,# minute hour dateOfMonth Month dayOfWeek command # Every night, at 01:01, run the archiver: 01 01 * * * /home/me/bin/dailyArchive # Every Saturday at 17:01, run the weekly archiver. 01 17 * * 6 /home/me/bin/weeklyArchive # Every 1st day of the month, at 07:01, run the monthly archiver. 01 07 01 * * /home/me/bin/monthlyArchive
Tuesday, 18 September 2012
archive with daily/weekly/monthly rotation
bin/dailyArchive
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment