我想要做一個簡單的暴發戶腳本,我似乎開始,我沒有看到一個錯誤。說它開始運行在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)
開始
[email protected]:$ 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
停止
[email protected]:$ 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!]? –
是的,我試過 –