尝试使用以下命令在CentOS上运行Rocket.Chat时:
systemctl start rocketchat.service
收到以下错误:
Failed to start rocketchat.service: Unit is not loaded properly: Bad message.
See system logs and systemctl status rocketchat.service for details.
当我运行命令systemctl status rocketchat.service
时,我得到:
Loaded: error (Reason: Bad message)
Active: inactive (dead)
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:3] Failed to add dependency on mongod.target[Service], ignoring: I... argument
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:4] Unknown lvalue 'Type' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:5] Unknown lvalue 'ExecStart' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:6] Unknown lvalue 'Restart' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:7] Unknown lvalue 'StandardOutput' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:8] Unknown lvalue 'StandardError' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:9] Unknown lvalue 'SyslogIdentifier' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:10] Unknown lvalue 'User' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:11] Unknown lvalue 'Environment' in section 'Unit'
Jan 18 08:56:12 localhost.relinns.com systemd[1]: [/etc/systemd/system/rocketchat.service:13] Invalid section header '[Install] WantedBy=multi-user.target'
Hint: Some lines were ellipsized, use -l to show in full.
问题出在哪里?
答案 0 :(得分:0)
无法添加对mongod.target [Service]的依赖
我在其他服务中遇到了类似的问题。问题出在您的systemctl配置文件上。在[Service]元素之前没有换行符,该元素实际上应开始一个新部分,并且不属于After元素。
因此,打开您的turbochat.service文件(可能在/ usr / lib / systemd / system中),并检查[Service]元素是否在新行上开始(检查该目录中的其他.service文件,例如格式正确的文件) )。看起来应该像
....
After=mongod.target
[Service]
....