Skip to content

Instantly share code, notes, and snippets.

@Hypfer
Created April 5, 2014 07:42
Show Gist options
  • Save Hypfer/9988614 to your computer and use it in GitHub Desktop.
Save Hypfer/9988614 to your computer and use it in GitHub Desktop.
Tvheadend Respawner
#!/bin/bash
main() {
while :
do
inotifywait -q -q -e modify /var/log/syslog && bash ./tvheadendrespawner.sh core
done
}
core() {
isthisimportant=`tail -5 /var/log/syslog | grep "CRASH" | grep "tvheadend"`
if [ -n "$isthisimportant" ]; then
service tvheadend restart
fi
}
#main class like stuff
case "$1" in
"core")
core
;;
*)
main
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment