1. 程式人生 > >centos7給進程分配pid文件

centos7給進程分配pid文件

centos7 進程 分配 文件

  • 讓進程後臺運行:
    somecode  &
  • 創建pid文件:
    echo  $!  >  /path/to/test.pid
  • 示例代碼:
    #!/bin/bash
    while true ; do
    echo "hello" > /etc/null
    sleep 1
    done &
    echo $! > /run/lib/test.pid
  • centos7給進程分配pid文件