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版本。