Categories
Kompai Paskaitos

backup script bash tar bzip2

touch /backup.sh mkdir /backup chmod a+x /backup.sh #!/bin/bash cd /backup file=”`date +%Y%m%d-%H%M%S`.tar” #echo $file tar -cf new.backup/$file folder_to_backup cd /backup/new.backup bzip2 -zq9 $file #rm $failas echo “backed up `date` \n” >> /backup/backup.made #remove older then 3 days to /backup/old.backup find -type f -mtime +3 -exec mv {} ../old.backup/ \; cd ../old.backup # completely remove backups, […]