站长天空|站长|服务器|安全|程序|SEO|工具

当前位置: 主页 > 系统架构 > Linux系统 > shell脚本 >

shell脚本循环判断进程是否存在

时间:2013-08-06 21:48来源:未知 作者:小糊涂神 点击:
1. [代码] shell脚本循环判断进程是否存在 01 #!/bin/sh 02 03 while true 04 do 05 process=` ps aux | grep mysqld | grep - v grep `; 06 07 if [ $process == ]; then 08 sleep 1; 09 echo no process ; 10 else 11 echo process exsits ; 12 break ; 13

1. [代码]shell脚本循环判断进程是否存在  

 
01 #!/bin/sh
02    
03 while true
04 do
05         process=`ps aux | grep mysqld | grep -v grep`;
06    
07         if [ "$process" == "" ]; then
08                 sleep 1;
09                 echo "no process";
10         else
11                 echo "process exsits";
12                 break;
13         fi
14 done

#!/bin/sh
#!/bin/sh

02    
#!/bin/sh    
 while true
 do
         process=`ps aux | grep mysqld | grep -v grep`;     
         if [ "$process" == "" ]; then
                 sleep 1; 
                echo "no process"; 
         else
                 echo "process exsits"; 
                 break; 

         fi 

 done
 

03 while true
04 do
05         process=`ps aux | grep mysqld | grep -v grep`;
06    
07         if [ "$process" == "" ]; then
08                 sleep 1;
09                 echo "no process";
10         else
11                 echo "process exsits";
12                 break;
13         fi
14 done
02    
03 while true
04 do
05         process=`ps aux | grep mysqld | grep -v grep`;
06    
07         if [ "$process" == "" ]; then
08                 sleep 1;
09                 echo "no process";
10         else
11                 echo "process exsits";
12                 break;
13         fi
14 done
(责任编辑:小糊涂神)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片