我想在amazon-linux-2上用systemctl启动Unicorn,但是Unicorn没有启动。
我已经编写了一个/etc/systemd/system/unicorn.service文件。
[Unit]
Description=The unicorn process
[Service]
User=myname
WorkingDirectory=/var/www/rails/myapp
SyslogIdentifier=unicorn
Type=simple
ExecStart=/bin/bash -l -c 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
[Install]
WantedBy=multi-user.target以下是我用来启动服务的命令
sudo systemctl daemon-reload
sudo systemctl start unicorn.service我找不到任何使用ps -ef | grep unicorn | grep -v grep命令的独角兽进程。
我在这里检查状态:
$ sudo systemctl status unicorn -l
● unicorn.service - The unicorn process
Loaded: loaded (/etc/systemd/system/unicorn.service; disabled; vendor preset: disabled)
Active: inactive (dead)
xxx.compute.internal systemd[1]: Started The unicorn process.
xxx.compute.internal systemd[1]: Starting The unicorn process...这是unicorn.log。(没有任何错误日志)
I, [2020-11-25T20:00:24.564840 #6604] INFO -- : Refreshing Gem list
I, [2020-11-25T20:00:25.278814 #6604] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
I, [2020-11-25T20:00:25.279020 #6604] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
I, [2020-11-25T20:00:25.299977 #6604] INFO -- : master process ready
I, [2020-11-25T20:00:25.406567 #6604] INFO -- : reaped #<Process::Status: pid 6607 exit 0> worker=0
I, [2020-11-25T20:00:25.406659 #6604] INFO -- : reaped #<Process::Status: pid 6608 exit 0> worker=1
I, [2020-11-25T20:00:25.406760 #6604] INFO -- : master complete为什么独角兽不能启动?
发布于 2021-05-17 18:34:39
将Type=simple更改为Type=forking。
https://stackoverflow.com/questions/65003507
复制相似问题