尝试让新贵启动和停止 nginx spawn-fcgi 进程
我正在使用spawn-fcgi 生成一个python 应用程序。如果我跑到下面它就可以了。
spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001
现在我想创建一个守护进程,以便它可以启动和停止,并且我可以使用 monit 来监视进程。我是一个新贵用户,但下面是我放置在 /etc/init 中的名为 PixelServer.conf 的文件。我对文件执行了 chmod +x 。
#!upstart
description "pixel server"
author "Test"
start on startup
stop on shutdown
script
export HOME="/root"
echo $$ > /var/run/pixelServer.pid
exec spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001 >> /var/log/pixelServer.sys.log 2>&1
#spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001
end script
pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/pixelServer.sys.log
end script
pre-stop script
rm /var/run/pixelServer.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/pixelServer.sys.log
end script
当我运行以下命令时,从 shell 中出现以下错误:
start pixelServer
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.66" (uid=1000 pid=29176 comm="start pixelServer ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))
那么...如何修复 upstart 文件?我知道spawn-fcgi不喜欢作为sudo运行。
I am using spawn-fcgi to spawn a python app. If I run below it works.
spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001
Now I want to create a daemon so it cna start and stop and I can use monit to monitor the proccess. I am a newbie upstart user but below is my file that I placed in /etc/init called pixelServer.conf. I did a chmod +x on the file.
#!upstart
description "pixel server"
author "Test"
start on startup
stop on shutdown
script
export HOME="/root"
echo $ > /var/run/pixelServer.pid
exec spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001 >> /var/log/pixelServer.sys.log 2>&1
#spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/ -f /home/ubuntu/workspace/rtbopsConfig/rtbPixelServer/index.py -a 127.0.0.1 -p 9001
end script
pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/pixelServer.sys.log
end script
pre-stop script
rm /var/run/pixelServer.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/pixelServer.sys.log
end script
from the shell when I run the below, I get below error:
start pixelServer
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.66" (uid=1000 pid=29176 comm="start pixelServer ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))
So...how to I fix the upstart file? I know that spawn-fcgi does not like to be run as sudo.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论