Skip to content

Instantly share code, notes, and snippets.

@Yuji-Kuroko
Created November 24, 2015 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yuji-Kuroko/e585859307f7477c6447 to your computer and use it in GitHub Desktop.
Save Yuji-Kuroko/e585859307f7477c6447 to your computer and use it in GitHub Desktop.
Standard backup shellscript.
#/bin/sh
src_dir="/path/to/dir"
dest_dir="/path/to/dir"
backup_dir=`date +'%Y%m%d'`
mkdir -p ${dest_dir}/${backup_dir}
rsync -a ${src_dir} ${dest_dir}/${backup_dir}
# zip archive
cd ${dest_dir} && zip -rm ${backup_dir}.zip ${backup_dir}
# everyday backup at 22:10
10 22 * * * root /path/to/basic_backup.sh >> /path/to/backup.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment