Amazon ec2 如何使用systemctl和systemd启动Unicorn

Amazon ec2 如何使用systemctl和systemd启动Unicorn,amazon-ec2,systemd,unicorn,autostart,amazon-linux-2,Amazon Ec2,Systemd,Unicorn,Autostart,Amazon Linux 2,我想在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/

我想在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的unicorn进程

我在这里检查状态:

$ 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]信息--:刷新宝石列表
一、 [2020-11-25T20:00:25.278814#6604]信息--:取消现有套接字的链接=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
一、 [2020-11-25T20:00:25.279020#6604]信息--:监听地址=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
一、 [2020-11-25T20:00:25.299977#6604]信息--:主流程就绪
一、 [2020-11-25T20:00:25.406567]信息--:收获的工人=0
一、 [2020-11-25T20:00:25.406659#6604]信息--:收获的工人=1
一、 [2020-11-25T20:00:25.406760#6604]信息--:主控完成

为什么独角兽不启动?

Type=simple
更改为
Type=forking

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