2

A service dies and I only get to know about it by noticing that something is broken. I'm sure this is happening more since the Debian 8 upgrade which brought systemd, although I'm not entirely sure systemd is to blame.

I'm not sure whether previously init just restarted things that died and systemd doesn't.

They symptom is systemctl status foo.service shows things like active (exited) or such.

Is there a way to notice a change in status in systemd managed services? And/or get it to attempt a restart a couple of times?

(I'm new to systemd.)

EDIT

Here's an example: Stunnel had stopped. Here's what I did to get it working again:

root@server:/root# systemctl status stunnel4
● stunnel4.service - LSB: Start or stop stunnel 4.x (SSL tunnel for network daemons)
   Loaded: loaded (/etc/init.d/stunnel4)
   Active: active (exited) since Sun 2016-05-01 07:03:54 BST; 2 days ago
  Process: 13443 ExecStop=/etc/init.d/stunnel4 stop (code=exited, status=0/SUCCESS)
  Process: 13455 ExecStart=/etc/init.d/stunnel4 start (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
root@server:/root# systemctl stop stunnel4  
root@server:/root# systemctl status stunnel4
● stunnel4.service - LSB: Start or stop stunnel 4.x (SSL tunnel for network daemons)
   Loaded: loaded (/etc/init.d/stunnel4)
   Active: inactive (dead) since Tue 2016-05-03 10:00:10 BST; 947ms ago
  Process: 13006 ExecStop=/etc/init.d/stunnel4 stop (code=exited, status=0/SUCCESS)
  Process: 13455 ExecStart=/etc/init.d/stunnel4 start (code=exited, status=0/SUCCESS)

May 03 10:00:10 servername stunnel4[13006]: Stopping SSL tunnels: stunnel.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
✗ Error in last command                                                                                                                                                                                            

root@server:/root# systemctl start stunnel4
root@server:/root# systemctl status stunnel4
● stunnel4.service - LSB: Start or stop stunnel 4.x (SSL tunnel for network daemons)
   Loaded: loaded (/etc/init.d/stunnel4)
   Active: active (running) since Tue 2016-05-03 10:00:18 BST; 1s ago
  Process: 13006 ExecStop=/etc/init.d/stunnel4 stop (code=exited, status=0/SUCCESS)
  Process: 13031 ExecStart=/etc/init.d/stunnel4 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/stunnel4.service
           └─13044 /usr/bin/stunnel4 /etc/stunnel/stunnel.conf

May 03 10:00:18 servername stunnel4[13031]: Starting SSL tunnels: [Started: /etc/stunnel/stunnel.conf] stunnel.

The only logs I can find seem to be a restart:

syslog.2.gz:May  1 07:03:54 pap1 stunnel4[13443]: Stopping SSL tunnels: [stopped: /etc/stunnel/stunnel.conf] stunnel.
syslog.2.gz:May  1 07:03:54 pap1 stunnel4[13455]: Starting SSL tunnels: [Already running: /etc/stunnel/stunnel.conf] stunnel.

that looks like it failed. I cannot figure why the restart happened (other question on systemd), nor why it failed.

artfulrobot
  • 2,949
  • 13
  • 36
  • 60
  • Did you write these units yourself? – Michael Hampton Mar 16 '16 at 19:50
  • No! They're ones packaged with Debian, eg mariadb and stunnel4. – artfulrobot Mar 16 '16 at 20:54
  • Then you might need to file bug reports on them. That doesn't sound like normal behavior. Of course, since you provided no real information, I'm not going to swear to that... – Michael Hampton Mar 16 '16 at 20:55
  • Yes sorry about the lack of verbatim information. I tend to focus on getting it up and running again and didn't stop to copy the diagnostic info. – artfulrobot Mar 16 '16 at 21:00
  • 1
    Those aren't real systemd units. They're old-style service files being called through sysvinit compatibility. This is not as reliable as actual systemd units. Consider either having the Debian package maintainer provide a real systemd unit, writing it yourself, or switching to another distribution. – Michael Hampton May 03 '16 at 09:43

0 Answers0