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

 

#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

 

你可能感兴趣的:(shell)