【问题标题】:Upstart - stop: Unknown instance:新贵 - 停止:未知实例:
【发布时间】: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

【问题讨论】:

标签: python upstart


【解决方案1】:

名称实例是test.py,而不是仅测试

命令是 sudo stop test.py

【讨论】:

  • sudo stop test.py 导致停止:未知作业:test.py
  • 试试pkill -9 -f test.py
猜你喜欢
  • 1970-01-01
  • 2012-10-29
  • 2014-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-15
  • 2012-12-04
相关资源
最近更新 更多