Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/bin/bash
  2. mount -t cifs //192.168.0.202/Volume_1 /mnt/nas -o username=Backup,password=PassBackup
  3. ocupado="$(df /mnt/nas|tail -n 1|awk '{print $4}'|cut -d "%" -f 1)"
  4. if [ $ocupado -gt 85 ]; then
  5. echo "DISK IS FULL" | mail -s "SERVER" mailaccount@domain.com
  6. else
  7. # This is anoying but at least works, I need to create a file with the name of the backup, delete it, and then make the backup with tar
  8. touch /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz
  9. rm -f /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz
  10. tar -cvzpf /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz --exclude=/home/general /home
  11. echo "FULL BACKUP OK" | mail -s "SERVER" mailaccount@domain.com
  12. fi
  13. umount /mnt/nas/
  14.  
  15. /tmp/crontab.jdwF9c
  16.  
  17. SHELL=/bin/bash
  18. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  19. MAILTO=root
  20. HOME=/
  21.  
  22. 0 9 1 * * root /root/myjobs/fullbackup.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement