Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # Get the week day
- today=`date +%A`
- dest=`date +%A_%d-%b-%Y_%H%M`
- result=
- #
- # Test the day of the week
- case "$today" in
- *"Sunday"*) printf "Today is Sunday"
- #
- # It's Sunday :!
- #
- # tar operation home to SafeHouse
- cd /home
- tar -zcvf /home/kerml/FreeNAS/SafeHouse/$dest.home.tar.gz *
- #
- # Send result to email
- if [[ $? -ne 0 ]]
- then
- echo "tar operation at SafeHouse on $dest not successful" | /bin/mail -v -s "Backup Result not successful" "marco.caeiro@gmail.com"
- else
- echo "tar operation at SafeHouse on $dest successful" | /bin/mail -v -s "Backup Result successful" "marco.caeiro@gmail.com"
- fi
- #
- # tar operation Dropbox to SafeHouse
- cd /home/kerml/Dropbox
- tar -zcvf /home/kerml/FreeNAS/SafeHouse/$dest.dropbox.tar.gz *
- if [[ $? -ne 0 ]]
- #
- # Send result to email
- then
- echo "tar operation at Dropbox on $dest not successful" | /bin/mail -v -s "Backup Result not successful" "marco.caeiro@gmail.com"
- else
- echo "tar operation at Dropbox on $dest successful" | /bin/mail -v -s "Backup Result successful" "marco.caeiro@gmail.com"
- fi
- ;;
- #
- # End of backups jobs on Sunday
- #
Add Comment
Please, Sign In to add comment