I am writing a custom legacy init script in Solaris 10 for testing purposes, which will be executing a dummy java program called SocketEcho. The problem is, I do not know how to stop the program correctly.
"pidof" is not available (from what I can tell).
I will start the program with
That SocketEcho script simply runs
in that same directory which has the class file. This works fine when executed manually (will test script functionality later), then I send it to the background.
Now I have to stop the program with
ps -ef | grep SocketEcho
I see the process listed as
Since pidof is not available, I have tried using pkill, but
pkill "java SocketEcho"
does not seem to be doing anything, so I have to bring the program to the foreground and ctrl-c. Simply using the ps command, cutting the PID and running it through kill is not really an acceptable solution as this does not carry over well to other scripts. I'm hoping somebody here has a better idea or knows what I am doing wrong. Thanks in advance.