开发者

Restart process script linux

开发者 https://www.devze.com 2023-02-05 13:21 出处:网络
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

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

精彩评论

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