bionic:

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


ubuntu@lp1839290-b:~$ systemctl cat bar
# /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-b:~$ sudo systemctl start foo
ubuntu@lp1839290-b:~$ sudo systemctl start bar
ubuntu@lp1839290-b:~$ 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:20:31 UTC; 4s ago
 Main PID: 8560 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/foo.service
           └─8560 /bin/sleep infinity

May 06 11:20:31 lp1839290-b 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:20:33 UTC; 3s ago
 Main PID: 8570 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/bar.service
           └─8570 /bin/sleep infinity

May 06 11:20:33 lp1839290-b systemd[1]: Started bar.service.


ubuntu@lp1839290-b:~$ sudo kill -6 8560
ubuntu@lp1839290-b:~$ systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: 
enabled)
   Active: failed (Result: core-dump) since Wed 2020-05-06 11:21:08 UTC; 1s ago
  Process: 8560 ExecStart=/bin/sleep infinity (code=dumped, signal=ABRT)
 Main PID: 8560 (code=dumped, signal=ABRT)

May 06 11:21:08 lp1839290-b systemd[1]: foo.service: Service has no hold-off 
time, scheduling restart.
May 06 11:21:08 lp1839290-b systemd[1]: foo.service: Failed to schedule restart 
job: Transaction is destructive.
May 06 11:21:08 lp1839290-b systemd[1]: foo.service: Failed with result 
'core-dump'.

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

May 06 11:20:33 lp1839290-b systemd[1]: Started bar.service.
May 06 11:21:08 lp1839290-b systemd[1]: Stopping bar.service...
May 06 11:21:08 lp1839290-b systemd[1]: Stopped bar.service.



ubuntu@lp1839290-b:~$ dpkg -l systemd|grep systemd
ii  systemd        237-3ubuntu10.40 amd64        system and service manager
ubuntu@lp1839290-b:~$ sudo systemctl start bar
ubuntu@lp1839290-b:~$ sudo systemctl start foo
ubuntu@lp1839290-b:~$ sudo 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:24:57 UTC; 10s ago
 Main PID: 1256 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/foo.service
           └─1256 /bin/sleep infinity

May 06 11:24:57 lp1839290-b 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:24:57 UTC; 10s ago
 Main PID: 1258 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/bar.service
           └─1258 /bin/sleep infinity

May 06 11:24:57 lp1839290-b systemd[1]: Started bar.service.
ubuntu@lp1839290-b:~$ sudo kill -6 1256
ubuntu@lp1839290-b:~$ sudo 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:25:19 UTC; 2s ago
 Main PID: 1276 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/foo.service
           └─1276 /bin/sleep infinity

May 06 11:25:19 lp1839290-b 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:25:19 UTC; 2s ago
 Main PID: 1277 (sleep)
    Tasks: 1 (limit: 4702)
   CGroup: /system.slice/bar.service
           └─1277 /bin/sleep infinity

May 06 11:25:19 lp1839290-b systemd[1]: Started bar.service.


ubuntu@lp1839290-b:~$ journalctl -b -u foo
-- Logs begin at Wed 2020-05-06 11:11:19 UTC, end at Wed 2020-05-06 11:25:22 
UTC. --
May 06 11:24:57 lp1839290-b systemd[1]: Started foo.service.
May 06 11:25:19 lp1839290-b systemd[1]: foo.service: Main process exited, 
code=dumped, status=6/ABRT
May 06 11:25:19 lp1839290-b systemd[1]: foo.service: Failed with result 
'core-dump'.
May 06 11:25:19 lp1839290-b systemd[1]: foo.service: Service has no hold-off 
time, scheduling restart.
May 06 11:25:19 lp1839290-b systemd[1]: foo.service: Scheduled restart job, 
restart counter is at 1.
May 06 11:25:19 lp1839290-b systemd[1]: Stopped foo.service.
May 06 11:25:19 lp1839290-b systemd[1]: Started foo.service.
ubuntu@lp1839290-b:~$ journalctl -b -u bar
-- Logs begin at Wed 2020-05-06 11:11:19 UTC, end at Wed 2020-05-06 11:25:57 
UTC. --
May 06 11:24:57 lp1839290-b systemd[1]: Started bar.service.
May 06 11:25:19 lp1839290-b systemd[1]: Stopping bar.service...
May 06 11:25:19 lp1839290-b systemd[1]: Stopped bar.service.
May 06 11:25:19 lp1839290-b systemd[1]: Started bar.service.


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

-- 
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
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to