Guest User

Untitled

a guest
Dec 5th, 2017
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # Get the week day
  4. today=`date +%A`
  5. dest=`date +%A_%d-%b-%Y_%H%M`
  6. result=
  7. #
  8. # Test the day of the week
  9. case "$today" in
  10.  *"Sunday"*) printf "Today is Sunday"
  11. #
  12. # It's Sunday :!
  13. #
  14. # tar operation home to SafeHouse
  15.   cd /home
  16.   tar -zcvf /home/kerml/FreeNAS/SafeHouse/$dest.home.tar.gz *
  17. #
  18. # Send result to email
  19.   if [[ $? -ne 0 ]]
  20.   then
  21.    echo "tar operation at SafeHouse on $dest not successful" | /bin/mail -v  -s "Backup Result not successful" "marco.caeiro@gmail.com"
  22.   else
  23.    echo "tar operation at SafeHouse on $dest successful" | /bin/mail -v  -s "Backup Result successful" "marco.caeiro@gmail.com"
  24.   fi
  25. #
  26. # tar operation Dropbox to SafeHouse
  27.   cd /home/kerml/Dropbox
  28.   tar -zcvf /home/kerml/FreeNAS/SafeHouse/$dest.dropbox.tar.gz *
  29.   if [[ $? -ne 0 ]]
  30. #
  31. # Send result to email
  32.   then
  33.    echo "tar operation at Dropbox on $dest not successful" | /bin/mail -v  -s "Backup Result not successful" "marco.caeiro@gmail.com"
  34.   else
  35.    echo "tar operation at Dropbox on $dest  successful" | /bin/mail -v  -s "Backup Result successful" "marco.caeiro@gmail.com"
  36.   fi
  37.   ;;
  38. #
  39. # End of backups jobs on Sunday
  40. #
Add Comment
Please, Sign In to add comment