这是一个创建于 2730 天前的主题,其中的信息可能已经有所发展或是发生改变。
本人非专业大拿,从网上看了教程,扒了扒有图比半天时间才写了这段,主要用作:
自动挂机时实时检测 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 帮忙看看哪里错了!!!
谢谢大家了,五一快乐~~~~~
7 条回复 • 2017-05-01 23:05:15 +08:00
|
|
2
leeger 2017-04-30 13:34:31 +08:00
是的啊····着急解决啊~~~~
|
|
|
3
Vicer 2017-05-01 00:40:01 +08:00 via Android
能花钱解决的问题都不是问题
|
|
|
4
lulinux 2017-05-01 05:28:08 +08:00
@ Vicer 有人会说,大家都是兄弟,谈钱伤感情。
|
|
|
5
ryanzyy 2017-05-01 11:13:54 +08:00
不是很懂 bash script 但是 我只想说 #!/bin/bash 可以实现的
#!/bin/python #!/bin/ruby 也可以实现
|
|
|
6
jyf007 2017-05-01 23:04:28 +08:00 via Android
用 systemd 建议改写 init.d 脚本实现,这种估计是把 firefox 改成守护进程使用。
|
|
|
7
jyf007 2017-05-01 23:05:15 +08:00 via Android
我不会也不用 systemd, 我用 openrc 但是估计有 bug
|