Understanding init script faults with sysctl

Posted on

Problem :

I made my own init script for starting a Mono web application within mod-mono-server2 container (I didn’t use AutoHosting, I’m aware of it).

When I had openSUSE 11.4 with init I was able to read on console exactly what went wrong. Now I had to migrate my app to a server running openSUSE 12.1 that uses systemctl, and it’s a mess to figure out why it fails to start.

The startup command is just a typical sudo -u mono-user mod-mono-server2 [params] that writes the PID to a file in /var/run/spambusters/ (to kill it when I want to stop).
When I try to do /etc/init.d/spambusters start I just get a generic Job failed. See system logs and 'systemctl status' for details..

But I can’t get more information………

spambusters@dom:~/source> sudo systemctl status spambusters.service
spambusters.service - LSB: Spambusters instance (as spambusters)
      Loaded: loaded (/etc/init.d/spambusters)
      Active: failed since Fri, 07 Sep 2012 20:37:56 +0200; 1min 37s ago
     Process: 29731 ExecStart=/etc/init.d/spambusters start (code=exited, status=1/FAILURE)
      CGroup: name=systemd:/system/spambusters.service
          â”” 29744 sudo -u spambusters /usr/bin/mod-mono-server2 --nonstop --port 8089 --address --applicat...

System log /var/log/messages only contains

Sep  7 20:37:56 dom sudo:     root : TTY=console ; PWD=/ ; USER=spambusters ; COMMAND=/usr/bin/mod-mono-server2 --nonstop --port 8089 --address --applications /:/home/spambusters/srv/www/domains/www.burnthespam.info/htdocs

While I understand that this question could also be suitable for serverfault.com because deals with server administration, my straight question is

How do I find more information about failure in an init script when root process is systemctl instead of init?

Solution :

If the OS uses systemd-journald,

journalctl -a _SYSTEMD_UNIT=spambusters.service

(Latest systemd version shows the same in systemctl status, but OpenSuSE has an older one.)

Also, do not use sudo if you only want it to run as a different user. Use User=spambusters instead.

Leave a Reply

Your email address will not be published. Required fields are marked *