I'm using CentOS 7. How do I figure out why a service is failing to start? I have created this service
[rails@server ~]$ sudo cat /usr/lib/systemd/system/nodejs.service [Unit] Description=nodejs server [Service] User=rails Group=rails ExecStart=/home/rails/NodeJSserver/start.sh ExecStop=/home/rails/NodeJSserver/stop.sh [Install] WantedBy=multi-user.target
The file points to this
[rails@server ~]$ cat /home/rails/NodeJSserver/start.sh #!/bin/bash forever start /home/rails/NodeJSserver/server.js
I can run this file just fine by itself. But when I try and run it as part of the service, I notice my nodeJS server isn't started. Even when I check "sudo systemctl --state=failed," I don't see any errors ...
[rails@server ~]$ sudo systemctl enable NodeJSserver [rails@server ~]$ sudo systemctl start NodeJSserver [rails@server ~]$ [rails@server ~]$ [rails@server ~]$ forever list info: No forever processes running [rails@server ~]$ [rails@server ~]$ [rails@server ~]$ sudo systemctl --state=failed UNIT LOAD ACTIVE SUB DESCRIPTION ● nginx.service loaded failed failed The nginx HTTP and reverse proxy server ● systemd-sysctl.service loaded failed failed Apply Kernel Variables ● systemd-vconsole-setup.service loaded failed failed Setup Virtual Console LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 3 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
How do I figure out why my service failed to start?