You can use pidof -x
if you know the process name, or kill -0
if you know the PID.
Example:
if pidof -x rsync >/dev/null
then
echo "Rsync is already running"
exit 1fi
By: rodion and mmoya
You can use pidof -x
if you know the process name, or kill -0
if you know the PID.
Example:
if pidof -x rsync >/dev/null
then
echo "Rsync is already running"
exit 1fi
By: rodion and mmoya