标签:starting start echo 终端 ps aux else 脚本 shel wc -l
1.打开shell终端,输入
sudo vi /etc/rc.local
2.在编辑器里面输入自己要启动的脚本
#!/bin/bash echo "run incar ai program..." cd /opt/robot nohup bash autorobot.sh & 2>/dev/null
3.启动脚本示例
#!/bin/bash #ppp connection errcount=0 while true do if (( $errcount > 10 )); then echo "rebooit" fi echo "errcount is $errcount" airobot=$(ps aux | grep airobot | grep -v grep |wc -l) echo $airobot if [ $airobot -eq 0 ]; then sleep 1 echo "no cold process" echo "starting" nohup ./airobot & errcount=$(( $errcount + 1 )) else echo "process exsits" fi sleep 10 done
标签:starting start echo 终端 ps aux else 脚本 shel wc -l
原文地址:https://www.cnblogs.com/cqwo/p/14043525.html