【发布时间】:2016-07-22 16:46:23
【问题描述】:
我正在尝试做一个简单的暴发户脚本,我似乎没有开始,我没有看到错误。说它开始在 5975 上运行。但是当我 ps ax | grep test 我看到 11 个实例时。
当我尝试sudo stop test 我得到stop: Unknown instance:
我的例子很简单,不确定我在这里做错了什么,但显然有些地方不对。
/etc/init/test.conf:
description "test script"
start on runlevel [2345]
stop on runlevel [016]
respawn
chdir /var/www/html
exec nohup python test.py > test.out &
test.py:
#!/usr/bin/python
import time
while 1:
print 'hello'
time.sleep(60)
开始
ubuntu@1234:$ sudo start test
test start/running, process 5975
ps ax | grep test
5967 ? S 0:00 python test.py
5970 ? S 0:00 python test.py
5973 ? S 0:00 python test.py
5976 ? S 0:00 python test.py
5979 ? S 0:00 python test.py
5982 ? S 0:00 python test.py
5985 ? S 0:00 python test.py
5988 ? S 0:00 python test.py
5991 ? S 0:00 python test.py
5994 ? S 0:00 python test.py
5997 ? S 0:00 python test.py
停止
ubuntu@1234:$ sudo stop test
stop: Unknown instance:
ps ax | grep test
5967 ? S 0:00 python test.py
5970 ? S 0:00 python test.py
5973 ? S 0:00 python test.py
5976 ? S 0:00 python test.py
5979 ? S 0:00 python test.py
5982 ? S 0:00 python test.py
5985 ? S 0:00 python test.py
5988 ? S 0:00 python test.py
5991 ? S 0:00 python test.py
5994 ? S 0:00 python test.py
5997 ? S 0:00 python test.py
【问题讨论】:
-
您是否已经尝试过 - 在运行级别 [!2345] 上停止?
-
是的,我试过了