【发布时间】:2018-05-13 11:42:29
【问题描述】:
我正在按照指南在我的服务器上安装 jekyll(运行 CentOS 7),因为我希望将 Web 开发作为一种爱好变得更好。免责声明,我没有在此服务器上使用反向代理,因为我想了解网站的一般设置并在创建更永久的东西之前了解 jekyll。 这是我使用的指南,因为我还没有找到更好的指南: https://hostpresto.com/community/tutorials/how-to-install-jekyll-on-centos-7/ 一些命令需要针对 RVM 等较新版本的东西进行调整,因为本指南有点旧。
所以我遇到的问题是当我被指示为 jekyll 制作 systemd 服务文件时。指南中推荐给我的代码如下:
[Unit]
Description=Jekyll service
After=syslog.target
After=network.target[Service]
User=jekyll
Type=simple
ExecStart=/usr/local/rvm/gems/ruby-2.3.3/bin/jekyll serve --source
"/home/jekyll/"
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=jekyll
[Install]
WantedBy=multi-user.target
它根本不会启动。当我启用时,它创建的链接很好,但是,拒绝启动。(我尝试将 2.3.3 更改为 2.4.1,因为它是我正在使用的 ruby 版本,但是仍然无法启动。)我没有编写systemd 文件的经验,所以我被困在这里,直到我知道我需要改变什么以及为什么。
检查状态时,我收到以下日志消息:
May 13 12:37:46 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:23] Invalid section header '[Install] WantedBy=multi-user.target'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:7] Failed to add dependency on network.target[Service], ignoring: Invalid argument
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:9] Unknown lvalue 'User' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:11] Unknown lvalue 'Type' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:13] Unknown lvalue 'ExecStart' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:15] Unknown lvalue 'Restart' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:17] Unknown lvalue 'StandardOutput' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:19] Unknown lvalue 'StandardError' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:21] Unknown lvalue 'SyslogIdentifier' in section 'Unit'
May 13 12:37:50 li1018-116.members.linode.com systemd[1]: [/etc/systemd/system/jekyll.service:23] Invalid section header '[Install] WantedBy=multi-user.target'
感谢任何帮助,我很想得到“为什么?”的解释。对于提供的任何提示或修复,我希望尽可能多地学习。
谢谢!
编辑 1:添加 systemctl 状态消息
【问题讨论】:
标签: ruby-on-rails jekyll centos7 systemd website-deployment