shell脚本,锁机制

[root@localhost wyb]# cat suijizhi.sh 
#!/bin/bash

a=`ps -ef|grep $0|grep -v grep |wc -l`
echo "$a"
[ $a -ne 2 ] && echo "123" && exit 1

for i in `seq 10`
do

   sleep 1000
done

[root@localhost wyb]# 

 

posted on 2016-08-30 23:13  王月波  阅读(895)  评论(0编辑  收藏  举报

导航