Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- admin="foo@bar.com"
- of=messages-backup-$(date +%Y%m%d).tgz
- cd /var/log/
- tar -czvf $of messages
- if [ $? -eq 0 ]; then
- mail -s "Backup of /var/log/messages was successful!" $admin
- exit 0
- else
- mail -s "Backup of /var/log/messages has failed!" $admin
- exit 1
- fi
- cp $of /home/user/
- rm -rf $of
- [root@nidesant2 Scripts]# ./backup.sh
- messages
- ^C
- (Interrupt -- one more to kill letter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement