An Entrepreneur, Coach, IT Consultant, Strategic Adviser, and a Traveler craving to explore and contribute to forming a better society.

Friday, August 21, 2009

Shell Scripting #0012: Backup files - Changed in last day (Yesterday)

No comments :
Backup files - Changed in last day (Yesterday)

The following script will archive/zip the files that are changed yesterday/lastday and Email the report after completing the backup

#!/bin/bash

BACKUPNAME=backup-`date +%d-%m-%Y`
tar -zcvf - `find . -mtime -1 -type f -print` > $BACKUPNAME.tar.gz && mail -s "Backup for the day `date +%d-%m-%Y` is completed " emailid@email.com

Note: if used "&&", mail command will be triggerred only if tar command is executed successfully

Featured Blog Topics:

No comments :