Skip to content

Instantly share code, notes, and snippets.

@wangsha
Created October 9, 2017 08:06
Show Gist options
  • Save wangsha/51fa53ae45fc0846f75af061699316b7 to your computer and use it in GitHub Desktop.
Save wangsha/51fa53ae45fc0846f75af061699316b7 to your computer and use it in GitHub Desktop.
Monit script auto check and update packages
check program outdated-package-test with path "/usr/bin/apt-get -u upgrade --assume-no"
if status != 0 then exec "DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -y -o DPkg::options::='--force-confdef' -o DPkg::options::='--force-confold' install grub-pc"
if status != 0 for 2 cycles then exec "/usr/bin/apt-get upgrade -y --force-yes -qq"
if status != 0 for 5 cycles then alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment