Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Check if Script is already running
- pidof -o %PPID -x "$0" >/dev/null && echo "ERROR: Script $0 already running" && exit 1
- # if the above doesn't work(if the version of pidof works differently)
- # then try this (I needed this for script on android with Termux)
- pgrep -f "$0"| grep -v $$ > /dev/null && echo "ERROR: Script $0 already running" && exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement