systemctl restart xxx* does not restart inactive services
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| systemd (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned | ||
Bug Description
Man pages of systemctl indicates that the start, restart, status takes in [PATTERN], which accepts wildcard.
However, for an inactive service, it does not work UNLESS --all is provided, which does not make sense for a command like restart. If one wants to restart only if service is active, there is the try-restart command.
To replicate
1. Stop a service. `systemctl stop sysstat.service`
2. Restart with wildcard. `systemctl restart sysstat*`
3. Check service status. It should still be inactive.
4. Restart with --all wildcard. `systemctl restart --all sysstat*`
5. Check again, service should have been started.
More logs below
root@notificati
● sysstat.service - LSB: Start/stop sysstat's sadc
Loaded: loaded (/etc/init.
Active: active (exited) since Mon 2016-09-26 16:22:02 AEST; 48min ago
Docs: man:systemd-
Process: 3607 ExecStop=
Process: 3809 ExecStart=
Tasks: 0
Memory: 0B
CPU: 0
Sep 26 16:22:02 notifications-m systemd[1]: Starting LSB: Start/stop sysstat's sadc...
Sep 26 16:22:02 notifications-m systemd[1]: Started LSB: Start/stop sysstat's sadc.
root@notificati
root@notificati
● sysstat.service - LSB: Start/stop sysstat's sadc
Loaded: loaded (/etc/init.
Active: inactive (dead) since Mon 2016-09-26 17:10:16 AEST; 1s ago
Docs: man:systemd-
Process: 8228 ExecStop=
Process: 3809 ExecStart=
Sep 26 16:22:02 notifications-m systemd[1]: Starting LSB: Start/stop sysstat's sadc...
Sep 26 16:22:02 notifications-m systemd[1]: Started LSB: Start/stop sysstat's sadc.
Sep 26 17:10:16 notifications-m systemd[1]: Stopping LSB: Start/stop sysstat's sadc...
Sep 26 17:10:16 notifications-m systemd[1]: Stopped LSB: Start/stop sysstat's sadc.
(reverse-
root@notificati
root@notificati
● sysstat.service - LSB: Start/stop sysstat's sadc
Loaded: loaded (/etc/init.
Active: inactive (dead) since Mon 2016-09-26 17:10:16 AEST; 16s ago
Docs: man:systemd-
Process: 8228 ExecStop=
Process: 3809 ExecStart=
Sep 26 16:22:02 notifications-m systemd[1]: Starting LSB: Start/stop sysstat's sadc...
Sep 26 16:22:02 notifications-m systemd[1]: Started LSB: Start/stop sysstat's sadc.
Sep 26 17:10:16 notifications-m systemd[1]: Stopping LSB: Start/stop sysstat's sadc...
Sep 26 17:10:16 notifications-m systemd[1]: Stopped LSB: Start/stop sysstat's sadc.
root@notificati
root@notificati
● sysstat.service - LSB: Start/stop sysstat's sadc
Loaded: loaded (/etc/init.
Active: active (exited) since Mon 2016-09-26 17:10:39 AEST; 1s ago
Docs: man:systemd-
Process: 8228 ExecStop=
Process: 8250 ExecStart=
Sep 26 17:10:39 notifications-m systemd[1]: Starting LSB: Start/stop sysstat's sadc...
Sep 26 17:10:39 notifications-m systemd[1]: Started LSB: Start/stop sysstat's sadc.

Right. As the manpage states, inactive units are not considered: "Units which are not active and are not in a failed state usually are not loaded, and will not be matched by any pattern."
This isn't a behaviour that we can or want to change downstream, so closing. Thanks!