Created
May 17, 2018 07:12
-
-
Save discarn8/879e4edd424298ab3f9ec67a52d454fc to your computer and use it in GitHub Desktop.
BASH - shell_script_check_for_conky_restart_if_not_found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /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