Skip to content

Instantly share code, notes, and snippets.

@wagesj45
Created January 9, 2019 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wagesj45/d1a89430f8090550d9660ab405b66c0e to your computer and use it in GitHub Desktop.
Save wagesj45/d1a89430f8090550d9660ab405b66c0e to your computer and use it in GitHub Desktop.
Executes a script only if it isn't already running.
#!/bin/bash
isrunning=$(ps -ef | grep -v grep | grep "podcast.sh" | wc -l)
if [ "$isrunning" -gt "0" ]; then
echo "[ALREADY RUNNING]"
exit 0
else
sudo /home/[your username]/podcast.sh
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment