我有以下新贵的工作:
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 作业的某些部分,而以非特权用户身份运行服务本身?