Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- mount -t cifs //192.168.0.202/Volume_1 /mnt/nas -o username=Backup,password=PassBackup
- ocupado="$(df /mnt/nas|tail -n 1|awk '{print $4}'|cut -d "%" -f 1)"
- if [ $ocupado -gt 85 ]; then
- echo "DISK IS FULL" | mail -s "SERVER" mailaccount@domain.com
- else
- # 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
- touch /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz
- rm -f /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz
- tar -cvzpf /mnt/nas/Backup/full_backup_`date +"%d%b%y"`.tar.gz --exclude=/home/general /home
- echo "FULL BACKUP OK" | mail -s "SERVER" mailaccount@domain.com
- fi
- umount /mnt/nas/
- /tmp/crontab.jdwF9c
- SHELL=/bin/bash
- PATH=/sbin:/bin:/usr/sbin:/usr/bin
- MAILTO=root
- HOME=/
- 0 9 1 * * root /root/myjobs/fullbackup.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement