Skip to content

Instantly share code, notes, and snippets.

@moali87
Created July 20, 2015 18:30
Show Gist options
  • Save moali87/bfb43b403ea563fa8aca to your computer and use it in GitHub Desktop.
Save moali87/bfb43b403ea563fa8aca to your computer and use it in GitHub Desktop.
minion_watchdog:
cloud.absent:
- tgt: {{ grains['id'] }}
- unless:
- cmd.run: /tmp/uptime_test
require:
- file: /tmp/uptime_test
/tmp/uptime_test:
file.managed:
- source: salt://minion_watchdog/uptime_test.sh
- user: root
- group: root
- mode: 644
Source File:
#!/bin/bash
UPTIME=$(awk '{ print $1 }' /proc/uptime | awk -F '.' '{ print $1 }')
if [[ $UPTIME -lt 300 ]]; then exit 0;else exit 1; fi
Output:
Summary
-----------
Succeeded: 0
Failed: 0
-----------
Total states run: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment