Skip to content

Instantly share code, notes, and snippets.

@smeghead
Created May 22, 2014 02:44
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 smeghead/edc0c231af7d755ef48f to your computer and use it in GitHub Desktop.
Save smeghead/edc0c231af7d755ef48f to your computer and use it in GitHub Desktop.
crontab 設定のバックアップスクリプト(履歴付き)
#!/bin/sh
dir=$(dirname $0)
backup_dir=$dir/../backup/crontab
mkdir -p $backup_dir
cp $backup_dir/crontab-backup $backup_dir/crontab-backup.1
crontab -l > $backup_dir/crontab-backup
diff -Nu $backup_dir/crontab-backup.1 $backup_dir/crontab-backup >> $backup_dir/crontab-history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment