[英]UPSTART script non root not working
I'm trying to run a nodejs application using upstart as a non root user. 我正在尝试以非root用户身份使用upstart运行nodejs应用程序。
But somehow parts of the script will not run : for instance: 但是脚本的某些部分将无法运行:例如:
"sudo initctl stop pdcapp"
"sudo initctl stop pdcapp"
sudo nameofApp start|stop
would not work sudo nameofApp start|stop
不起作用 sudo initctl stop nameofApp
the pre-stop script will not echo to the log file sudo initctl stop nameofApp
, sudo initctl stop nameofApp
前脚本不会回显到日志文件 isn't a more cleaner easier way of doing this (systemd) I've looked a various tutorials around and apparently this is how they've doneit. 这不是一种更清洁,更轻松的方式(系统化),我看过各种教程,显然这就是他们的方法。 so what am I missing here?
所以我在这里想念什么?
This is the .conf file under /etc/init/ 这是/ etc / init /下的.conf文件
env FULL_PATH="/srv/pd/sept011100/dev"
env NODE_PATH="/usr/local/nodeJS/bin/node"
env NODE_ENV=production
start on filesystem or runlevel [2345]
stop on [!2345]
script
export NODE_ENV #this variable is never set
echo $$ > /var/run/PD.pid
cd $FULL_PATH
# the command below will not work
#exec sudo -u nginx "$NODE_PATH server.js >> /var/log/PD/pdapp.log 2>&1"
exec $NODE_PATH server.js >> /var/log/PD/pdapp.log 2>&1
end script
pre-start script
echo "[`date`] (sys) Starting" >> /var/log/PD/pdapp.log
end script
pre-stop script
rm /var/run/pdapp.pid
echo "[`date`] (sys) Stopping" >> /var/log/PDC/pdapp.log
end script
in /var/log/messages I get this when I stop the application, otherwise I get nothing in the logfile 在/ var / log / messages中,我在停止应用程序时得到了此消息,否则在日志文件中什么也没得到
Sep 2 18:23:14 547610-redhat-dev2 init: pdcapp pre-stop process (6903) terminated with status 1
Sep 2 18:23:14 547610-redhat-dev2 init: pdcapp main process (6899) terminated with status 143
any Ideas why is this not working I'm running redhat 6.5 任何想法为什么这不起作用我正在运行redhat 6.5
Red Hat具有一个过时的超级版本的Upstart,可能充满了错误,因为尽管使用了它,但它们从未对Upstart有所贡献(在RHEL 6发布后,Fedora便立即切换到systemd,甚至还没有对其进行很好的尝试)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.