Created
December 12, 2018 19:21
-
-
Save saml/fba41acc7aa56e6bed567342064e035b to your computer and use it in GitHub Desktop.
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 | |
| prog="$(basename "$0")" | |
| count="$(pkill --signal 0 -c "$prog")" | |
| if [[ "$count" = "1" ]] | |
| then | |
| notify-send 'I will notify you after 20 mins' | |
| sleep $(( 20 * 60 )) | |
| notify-send -u critical 'Look away for 20 seconds' | |
| else | |
| duration=$(ps aux|grep "$prog"|grep -v grep|awk '{print $9}') | |
| notify-send "Already running $duration" | |
| exit 1 | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment