Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- day=$(date +%F)
- #folder where is the backup
- Folder="/home/teamportal/data/filestorage/www/_cron_db_bak"
- #file to create
- File="/root/backup/$day.tar"
- #tmp folder for another script ftp copy
- Folder2="/root/temporanea"
- #find 1 day old file and copy to the ftp folder
- find $Folder -iname "*.backup" -mtime -1 -print0 | xargs -0 -r -I file cp -v -p file $Folder2
- #create tar
- tar cvf $File $Folder2
- #send it via mutt
- cat /home/mailmessage.txt |mutt -a $File -s "BACKUP Database" -- your-mail@gmail.com
- #remove 90+ days old file
- find $File* -mtime +90 -exec rm {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement