Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save discarn8/879e4edd424298ab3f9ec67a52d454fc to your computer and use it in GitHub Desktop.

Select an option

Save discarn8/879e4edd424298ab3f9ec67a52d454fc to your computer and use it in GitHub Desktop.
BASH - shell_script_check_for_conky_restart_if_not_found
#! /bin/bash
# Don't forget to add this script to your cron
logfile="/var/log/conky_check.log"
case "$(pidof conky | wc -w)" in
0) echo "conky found not running, (re)starting conky: $(date)" >> $logfile
DISPLAY=:0 /home/user/.conky/conky_start &
;;
1) echo "conky found running, all OK: $(date)" >> $logfile
;;
*) echo "multiple instances of conky found running. Stopping & restarting conky: $(date)" >> $logfile
kill $(pidof conky | awk '{print $1}')
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment