Wednesday, December 29, 2010

Backup script using 7Zip, cron and NSLU2

Have written a script to zip and archive important folders on the NSLU2:
    sudo 7za u /media/nslu2/backup/backup /media/Pictures /media/Documents -mx9 -mmt -mhe -ppassword

This backs up my Pictures and Documents drives to a 7zip archive called backup in the backup folder on the NSLU2. The command 'u' means update the archive, which will check for what has updated rather than just archiving everything each time. The options are:
    -mx9 - maximum compression
    -mht - use multi-threading where there's more than one CPU. I think this is on by default anyway
    -mhe - encrypt the file headers. I think this relies on the next option:
    -ppassword - supplies the password 'password'. Not sure whether it does any encryption with this or it's just to restrict access

I've put this in my crontab:
    0 3 * * 7 sudo 7za u /media/nslu2/backup/backup /media/Pictures /media/Documents -mx9 -mmt -mhe -ppassword
It'll run at 3am every Sunday.

No comments:

Post a Comment