本人非专业大拿,从网上看了教程,扒了扒有图比半天时间才写了这段,主要用作:
自动挂机时实时检测 firefox 状态( eb 有时跳转其他页面,有时 firefox 自动关闭),内存中如果没有 firefox 自动启动!
但是运行起来有问题,大家帮忙看看!!
#!/bin/bash
export DISPLAY=localhost:1.0
t=0
XX=30
while [ 1 ]
do
if [ -z $(pgrep firefox) ]
then
echo “ firefox is booting now!”
firefox
else
echo “ firefox is working!!!!”
fi
sleep 1
t=$(( $t+1 ))
if [ $t -gt 10 ]
then
killall -9 firefox
t=0
fi
done
<a href="http://i2.muimg.com/4851/db60c60512d9b0a9.png" title="点击显示原始图片"><img src="http://i2.muimg.com/4851/db60c60512d9b0a9t.jpg"></a>问题:
1、明明脚本检测时 firefox 已经退出,但是还能检测在运行?(好像第一段 if 失效)
2、还会出现 Xlib: extension "RANDR" missing on display "localhost:1.0" 错误!,请 dadiao 帮忙看看哪里错了!!!
谢谢大家了,五一快乐~~~~~
自动挂机时实时检测 firefox 状态( eb 有时跳转其他页面,有时 firefox 自动关闭),内存中如果没有 firefox 自动启动!
但是运行起来有问题,大家帮忙看看!!
#!/bin/bash
export DISPLAY=localhost:1.0
t=0
XX=30
while [ 1 ]
do
if [ -z $(pgrep firefox) ]
then
echo “ firefox is booting now!”
firefox
else
echo “ firefox is working!!!!”
fi
sleep 1
t=$(( $t+1 ))
if [ $t -gt 10 ]
then
killall -9 firefox
t=0
fi
done
<a href="http://i2.muimg.com/4851/db60c60512d9b0a9.png" title="点击显示原始图片"><img src="http://i2.muimg.com/4851/db60c60512d9b0a9t.jpg"></a>问题:
1、明明脚本检测时 firefox 已经退出,但是还能检测在运行?(好像第一段 if 失效)
2、还会出现 Xlib: extension "RANDR" missing on display "localhost:1.0" 错误!,请 dadiao 帮忙看看哪里错了!!!
谢谢大家了,五一快乐~~~~~