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.
xenial:
ubuntu@ lp1839290- x:~$ dpkg -l systemd|grep systemd lp1839290- x:~$ systemctl cat foo system/ foo.service system/ foo.service /bin/sleep infinity
ii systemd 229-4ubuntu21.27 amd64 system and service manager
ubuntu@
# /etc/systemd/
# /etc/systemd/
[Unit]
PartOf=bar.service
[Service]
ExecStart=
RestartSec=0s
Restart=always
ubuntu@ lp1839290- x:~$ systemctl cat bar system/ bar.service system/ bar.service /bin/sleep infinity
# /etc/systemd/
# /etc/systemd/
[Unit]
BindsTo=foo.service
#Same with or without After=, the window is very small to make a difference.
After=foo.service
[Service]
ExecStart=
ubuntu@ lp1839290- x:~$ sudo systemctl start foo lp1839290- x:~$ sudo systemctl start bar lp1839290- x:~$ systemctl status foo bar system/ foo.service; static; vendor preset: enabled) slice/foo. service
ubuntu@
ubuntu@
● foo.service
Loaded: loaded (/etc/systemd/
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.
└─1268 /bin/sleep infinity
May 06 11:28:14 lp1839290-x systemd[1]: Started foo.service.
● bar.service system/ bar.service; static; vendor preset: enabled) slice/bar. service
Loaded: loaded (/etc/systemd/
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.
└─1273 /bin/sleep infinity
May 06 11:28:17 lp1839290-x systemd[1]: Started bar.service. lp1839290- x:~$ sudo kill -6 1268 lp1839290- x:~$ systemctl status foo bar system/ foo.service; static; vendor preset: enabled) /bin/sleep infinity (code=dumped, signal=ABRT)
ubuntu@
ubuntu@
● foo.service
Loaded: loaded (/etc/systemd/
Active: failed (Result: resources) since Wed 2020-05-06 11:28:29 UTC; 929ms ago
Process: 1268 ExecStart=
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 system/ bar.service; static; vendor preset: enabled) /bin/sleep infinity (code=killed, signal=TERM)
Loaded: loaded (/etc/systemd/
Active: inactive (dead) since Wed 2020-05-06 11:28:29 UTC; 931ms ago
Process: 1273 ExecStart=
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 lp1839290- x:~$ sudo systemctl start foo lp1839290- x:~$ sudo systemctl start bar lp1839290- x:~$ systemctl status foo bar system/ foo.service; static; vendor preset: enabl slice/foo. service
ii systemd 229-4ubuntu21.28 amd64 system and service manager
ubuntu@
ubuntu@
ubuntu@
● foo.service
Loaded: loaded (/etc/systemd/
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.
└─1238 /bin/sleep infinity
May 06 11:31:03 lp1839290-x systemd[1]: Started foo.service.
● bar.service system/ bar.service; static; vendor preset: enabl slice/bar. service
Loaded: loaded (/etc/systemd/
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.
└─1243 /bin/sleep infinity
May 06 11:31:05 lp1839290-x systemd[1]: Started bar.service.
ubuntu@ lp1839290- x:~$ sudo kill -6 1238 lp1839290- x:~$ systemctl status foo bar system/ foo.service; static; vendor preset: enabled) slice/foo. service
ubuntu@
● foo.service
Loaded: loaded (/etc/systemd/
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.
└─1257 /bin/sleep infinity
May 06 11:31:32 lp1839290-x systemd[1]: Started foo.service.
● bar.service system/ bar.service; static; vendor preset: enabled) slice/bar. service
Loaded: loaded (/etc/systemd/
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.
└─1258 /bin/sleep infinity
May 06 11:31:32 lp1839290-x systemd[1]: Started bar.service. lp1839290- x:~$ journalctl -b -u foo lp1839290- x:~$ journalctl -b -u bar
ubuntu@
-- 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@
-- 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.