开发者社区 问答 正文

linux监听进程或pid,如果关闭,就执行关机,怎么写脚本

linux监听进程或pid,如果关闭,就执行关机,怎么写脚本

展开
收起
a123456678 2016-06-14 15:43:40 3287 分享 版权
1 条回答
写回答
取消 提交回答
  • #!/bin/sh
    while ps -e | grep "$1" > /dev/null; do
      sleep 3
    done
    shutdown -p now
    2019-07-17 19:37:55
    赞同 展开评论