GNU bash, version 1.14.7(1)
I have a script is called \"abc.sh
\"
I have to check this from abc.sh
script only...
inside it I have written f
pidof
wasn't working for me so I searched some more and came across pgrep
for pid in $(pgrep -f my_script.sh); do
if [ $pid != $$ ]; then
echo "[$(date)] : my_script.sh : Process is already running with PID $pid"
exit 1
else
echo "Running with PID $pid"
fi
done
Taken in part from answers above and https://askubuntu.com/a/803106/802276