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
精彩评论