xenial:

ubuntu@lp1839290-x:~$ dpkg -l systemd|grep systemd
ii  systemd        229-4ubuntu21.27 amd64        system and service manager
ubuntu@lp1839290-x:~$ systemctl cat foo
# /etc/systemd/system/foo.service
# /etc/systemd/system/foo.service
[Unit]
PartOf=bar.service
[Service]
ExecStart=/bin/sleep infinity
RestartSec=0s
Restart=always


ubuntu@lp1839290-x:~$ systemctl cat bar
# /etc/systemd/system/bar.service
# /etc/systemd/system/bar.service
[Unit]
BindsTo=foo.service
#Same with or without After=, the window is very small to make a difference.
After=foo.service
[Service]
ExecStart=/bin/sleep infinity


ubuntu@lp1839290-x:~$ sudo systemctl start foo
ubuntu@lp1839290-x:~$ sudo systemctl start bar
ubuntu@lp1839290-x:~$ systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: 
enabled)
   Active: active (running) since Wed 2020-05-06 11:28:14 UTC; 5s ago
 Main PID: 1268 (sleep)
    Tasks: 1
   Memory: 80.0K
      CPU: 1ms
   CGroup: /system.slice/foo.service
           └─1268 /bin/sleep infinity

May 06 11:28:14 lp1839290-x systemd[1]: Started foo.service.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: 
enabled)
   Active: active (running) since Wed 2020-05-06 11:28:17 UTC; 3s ago
 Main PID: 1273 (sleep)
    Tasks: 1
   Memory: 84.0K
      CPU: 1ms
   CGroup: /system.slice/bar.service
           └─1273 /bin/sleep infinity

May 06 11:28:17 lp1839290-x systemd[1]: Started bar.service.
ubuntu@lp1839290-x:~$ sudo kill -6 1268
ubuntu@lp1839290-x:~$ systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: 
enabled)
   Active: failed (Result: resources) since Wed 2020-05-06 11:28:29 UTC; 929ms 
ago
  Process: 1268 ExecStart=/bin/sleep infinity (code=dumped, signal=ABRT)
 Main PID: 1268 (code=dumped, signal=ABRT)

May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Unit entered failed state.
May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Failed with result 
'core-dump'.
May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Service has no hold-off 
time, scheduling restart.
May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Failed to schedule restart 
job: Transaction is destructive.
May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Unit entered failed state.
May 06 11:28:29 lp1839290-x systemd[1]: foo.service: Failed with result 
'resources'.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: 
enabled)
   Active: inactive (dead) since Wed 2020-05-06 11:28:29 UTC; 931ms ago
  Process: 1273 ExecStart=/bin/sleep infinity (code=killed, signal=TERM)
 Main PID: 1273 (code=killed, signal=TERM)

May 06 11:28:17 lp1839290-x systemd[1]: Started bar.service.
May 06 11:28:29 lp1839290-x systemd[1]: Stopping bar.service...
May 06 11:28:29 lp1839290-x systemd[1]: Stopped bar.service.



ubuntu@lp1839290-x:~$ dpkg -l systemd|grep systemd
ii  systemd        229-4ubuntu21.28 amd64        system and service manager
ubuntu@lp1839290-x:~$ sudo systemctl start foo
ubuntu@lp1839290-x:~$ sudo systemctl start bar
ubuntu@lp1839290-x:~$ systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: enabl
   Active: active (running) since Wed 2020-05-06 11:31:03 UTC; 6s ago
 Main PID: 1238 (sleep)
    Tasks: 1
   Memory: 84.0K
      CPU: 1ms
   CGroup: /system.slice/foo.service
           └─1238 /bin/sleep infinity

May 06 11:31:03 lp1839290-x systemd[1]: Started foo.service.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: enabl
   Active: active (running) since Wed 2020-05-06 11:31:05 UTC; 3s ago
 Main PID: 1243 (sleep)
    Tasks: 1
   Memory: 84.0K
      CPU: 1ms
   CGroup: /system.slice/bar.service
           └─1243 /bin/sleep infinity

May 06 11:31:05 lp1839290-x systemd[1]: Started bar.service.

ubuntu@lp1839290-x:~$ sudo kill -6 1238
ubuntu@lp1839290-x:~$ systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: 
enabled)
   Active: active (running) since Wed 2020-05-06 11:31:32 UTC; 1s ago
 Main PID: 1257 (sleep)
    Tasks: 1
   Memory: 80.0K
      CPU: 1ms
   CGroup: /system.slice/foo.service
           └─1257 /bin/sleep infinity

May 06 11:31:32 lp1839290-x systemd[1]: Started foo.service.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: 
enabled)
   Active: active (running) since Wed 2020-05-06 11:31:32 UTC; 1s ago
 Main PID: 1258 (sleep)
    Tasks: 1
   Memory: 80.0K
      CPU: 1ms
   CGroup: /system.slice/bar.service
           └─1258 /bin/sleep infinity

May 06 11:31:32 lp1839290-x systemd[1]: Started bar.service.
ubuntu@lp1839290-x:~$ journalctl -b -u foo
-- Logs begin at Wed 2020-05-06 11:30:16 UTC, end at Wed 2020-05-06 11:31:35 
UTC. --
May 06 11:31:03 lp1839290-x systemd[1]: Started foo.service.
May 06 11:31:32 lp1839290-x systemd[1]: foo.service: Main process exited, 
code=dumped, status=6/ABRT
May 06 11:31:32 lp1839290-x systemd[1]: foo.service: Unit entered failed state.
May 06 11:31:32 lp1839290-x systemd[1]: foo.service: Failed with result 
'core-dump'.
May 06 11:31:32 lp1839290-x systemd[1]: foo.service: Service has no hold-off 
time, scheduling restart.
May 06 11:31:32 lp1839290-x systemd[1]: Stopped foo.service.
May 06 11:31:32 lp1839290-x systemd[1]: Started foo.service.
ubuntu@lp1839290-x:~$ journalctl -b -u bar
-- Logs begin at Wed 2020-05-06 11:30:16 UTC, end at Wed 2020-05-06 11:31:35 
UTC. --
May 06 11:31:05 lp1839290-x systemd[1]: Started bar.service.
May 06 11:31:32 lp1839290-x systemd[1]: Stopping bar.service...
May 06 11:31:32 lp1839290-x systemd[1]: Stopped bar.service.
May 06 11:31:32 lp1839290-x systemd[1]: Started bar.service.


** Tags removed: verification-needed verification-needed-xenial
** Tags added: verification-done verification-done-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1839290

Title:
  systemd doesn't restart a service after crashes

To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1839290/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to