Execute bash script and get the pid of that script process
#!/bin/bash
curpid=$$;
echo "curpid=${curpid}"
Another script to check if a current process pid is still running
The script name is test.bash
#!/bin/bash
curpid=$$;
echo "curpid=${curpid}";
if ps -p $curpid | grep $curpid | grep "test.bash" >> /dev/null; then
echo "Your script is running";
else
echo "Not running";
fi
[Click to add or edit comments])
Please prepend comments below including a date