Hi,
I created a procd service to run a script passing some parameters.
Now, I wanna ensure that user doesn't start the same service, from terminal or other ways.
For this I added the following code in my script,
pid=$(pgrep -f "openwisp_monitoring.*--mode send")
if [ "$pid" ]; then
echoerr "A process to send data is already running"
exit 1
fi
But, when I am calling /etc/init.d/openwisp_monitoring restart
, I am getting this error message and the service is not starting.
What should be done in this case?