I have created a simple script to start a process, but I am not sure how to add a stop step since the process is ran/stopped manually
Currently, to start the process, we use a single command line
omrun dssdaemon <a string to run>
Then, to stop it, the usual ps command
ps -ef | grep -i dssdaemon
kill -9 <PID>
I have gotten this far
#!/bin/sh
# Priti's script to start dss daemon
pid=$(ps -ef | grep dssdaemon | grep -v grep | awk '{print $2}')
DSS_START=omrun dssdaemon <a string to run>
$DSS_START; sleep 15;
echo "DSS Daemons is running with PID[S] below" && $pid
The process has some limitation with using pidof, that is why I have created the awk string instead.
I could really use some help with adding a status and kill step.
Something like this
# status dss daemon
DSS Daemon is running with PID[S] below
123456
432145
start dss daemon
DSS Daemon is started with PID[S] below
123456
432145
stop dss daemon
DSS Daemon with PID[S] below were killed
123456
432145
-9
to let the process terminate in an orderly fashion. The default SIGTERM should do the trick. Use SIGKILL (-9) as a last resort only. – markgraf Feb 23 '23 at 07:31$#
andshift
– 404 Name Not Found Feb 23 '23 at 13:38