开发者

Restart process script linux

Can anyone helps me with开发者_JAVA百科 a script which find process id by name and then restart it ?


pidof PROG_NAME | xargs kill -9 ; PROG_NAME

kills every instance of PROG_NAME and restarts an instance (if PROG_NAME is in your PATH)


it's depends expecting/prefer behavior, i'm use this inside script:

killall $1 && $1 &

(it's not load new instance if/before current not closed properly)

then binding it to alias in ~/.bashrc:

alias rld='/path_to_script/script.sh'

then just (in console):

rld process_name

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜