由于 systemd 服务似乎默默地停止了

由于 systemd 服务似乎默默地停止了

服务挂了,我只能通过注意到有东西坏了才知道。我确信自从 Debian 8 升级到 systemd 以来,这种情况发生得更多了,尽管我并不完全肯定是 systemd 造成的。

我不确定之前 init 是否只是重新启动了死亡的东西而 systemd 却没有。

它们的症状是systemctl status foo.service表现出诸如活跃(退出)或诸如此类的情况。

有没有办法注意到 systemd 管理服务的状态变化?和/或让它尝试重启几次?

(我是 systemd 的新手。)

编辑

以下是示例:Stunnel 已停止。以下是我为使其重新运行所执行的操作:

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.

我能找到的唯一日志似乎是重新启动:

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.

看起来好像失败了。我不明白为什么会发生重启(有关 systemd 的其他问题),也不知道它为何会失败。

相关内容