tags:

views:

21

answers:

1

I have been using the following way to kill a process manually

ps -ef | grep process
kill -9 process id of process
start the process again

But i think how to do it programmitically as in write in a shellscript i just have to run e.g. ./restartProcess.sh

Thanks

+1  A: 

use an editor to create a file named restartProcess.sh

kill $(pgrep process)
start the process again 

Put the above in it, then chmod +x restartProcess.sh

several points -

Just use kill pid, this allows the process to cleanup if it was written reasonably well.

kill $(pgrep process)

is the solaris version of the first two lines of your script.

jim mcnamara