Skip to content

Instantly share code, notes, and snippets.

@mattkasa
Created February 13, 2014 18:50
Show Gist options
  • Save mattkasa/8981322 to your computer and use it in GitHub Desktop.
Save mattkasa/8981322 to your computer and use it in GitHub Desktop.
#!/bin/bash
case "${1}" in
disable)
# Disable chef-client cron job
knife ssh "${2}" 'sudo bash -c "crontab -l | sed -e /^[^#].*\\\\/usr\\\\/bin\\\\/chef-client/s/^/#/ | crontab -"'
;;
enable)
# Enable chef-client cron job
knife ssh "${2}" 'sudo bash -c "crontab -l | sed -e /^#.*\\\\/usr\\\\/bin\\\\/chef-client/s/^#// | crontab -"'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment