小编Chr*_*ian的帖子

新贵:以非特权用户身份运行服务并以 root 身份运行预启动脚本

我有以下新贵的工作:

description "posty api"


start on mysql
stop on shutdown

env RACK_ENV=production

setuid vmail
setgid vmail

chdir /opt/posty_api

pre-start script
    mkdir -p /var/run/posty
    chown -R vmail:root /var/run/posty
end script

exec /usr/local/bin/unicorn -D -c /opt/posty_api/unicorn.rb --env production >> /var/log/posty/upstart.log 2>&1

post-stop exec kill `cat /var/run/posty/unicorn.pid`

respawn
respawn limit 1 10
Run Code Online (Sandbox Code Playgroud)

要在/var/run我需要 root 权限中创建文件夹。如何以 root 身份运行 upstart 作业的某些部分,而以非特权用户身份运行服务本身?

linux upstart

8
推荐指数
1
解决办法
9149
查看次数

标签 统计

linux ×1

upstart ×1