【发布时间】:2016-03-15 15:05:49
【问题描述】:
我已经为systemctl 写了一个systemd 文件来启动unicorn:
[Unit]
Description=Unicorn server
[Service]
SyslogIdentifier=my-app-unicorn
User=deployer
PIDFile=/tmp/unicorn.my-app.pid
WorkingDirectory=/opt/www/my-app.com
ExecStart=/home/deployer/.rvm/gems/ruby-2.2.1@my-app/bin/bundle exec "unicorn_rails -D -c /opt/www/my-app.com/config/unicorn.rb -E production"
#ExecReload=/bin/kill -s HUP $MAINPID
ExecReload=/bin/kill -s USR2 $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
这是我用来启动服务的命令
$ sudo systemctl daemon-reload
$ sudo systemctl start my-app.service
我在这里查看状态:
$ sudo systemctl status my-app
● my-app.service - My app unicorn server
Loaded: loaded (/lib/systemd/system/my-app.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2016-03-15 14:56:31 UTC; 4s ago
Process: 22165 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=200/CHDIR)
Process: 22162 ExecStart=/home/deployer/.rvm/gems/ruby-2.2.1@my-app/bin/bundle exec unicorn_rails -D -c /opt/www/my-app.com/config/unicorn.rb -E production (code=exited, status=200/CHDIR)
Main PID: 22162 (code=exited, status=200/CHDIR)
Mar 15 14:56:31 fat-man systemd[1]: Started My-App unicorn server.
Mar 15 14:56:31 fat-man systemd[22162]: my-app.service: Failed at step CHDIR spawning /home/deployer/.rvm/gems/ruby-2.2.1@my-app/bin/bundle: No such file or directory
Mar 15 14:56:31 fat-man systemd[1]: my-app.service: Main process exited, code=exited, status=200/CHDIR
Mar 15 14:56:31 fat-man systemd[1]: my-app.service: Control process exited, code=exited status=200
Mar 15 14:56:31 fat-man systemd[1]: my-app.service: Unit entered failed state.
Mar 15 14:56:31 fat-man systemd[1]: my-app.service: Failed with result 'exit-code'.
可能是什么问题?
【问题讨论】:
标签: rubygems rvm bundler unicorn systemd