shell保证一个程序实例在运行

来源:互联网 发布:excel恢复数据 编辑:程序博客网 时间:2024/06/13 22:55

 

#Is there another process running now?

lockfile -1 -r2 /var/run/r_sh.pid 2>/dev/null

test "$?" = 0||exit 1

echo $$>/var/run/r_sh.pid

 

原创粉丝点击