0
我一直用以下的方式来杀死一个进程手动如何编写将以编程方式终止进程的shell脚本?
ps -ef | grep process
kill -9 process id of process
start the process again
但我认为如何programmitically做它作为写在shell脚本 我只需要运行例如./restartProcess.sh
感谢
我一直用以下的方式来杀死一个进程手动如何编写将以编程方式终止进程的shell脚本?
ps -ef | grep process
kill -9 process id of process
start the process again
但我认为如何programmitically做它作为写在shell脚本 我只需要运行例如./restartProcess.sh
感谢
使用编辑器创建一个名为restartProcess.sh
文件kill $(pgrep process)
start the process again
把上面的话,那么使用chmod + X restartProcess.sh
几个积分 -
只要使用kill pid,这可以使进程清理,如果它写得相当好。
kill $(pgrep process)
是脚本前两行的solaris版本。