restarting all specific units on systemctl without for loop?
UPDATE Systemd supports wildcards from systemd-209 forward https://serverfault.com/a/797926/291826
Two years later systemctl still doesn't allow wildcards, even though they would be extremely useful.
I did however take your note about systemctl -t service --failed
and I hacked together this. I decided to post it here because the next person to find this question could be helped by it.
systemctl restart $(systemctl -t service --failed | grep openstack-nova-*.service | cut -d ' ' -f 1)
This takes systemctl -t service --failed
, greps for the services matching "openstack-nova-*.service" and then removes the descriptors of those files by cutting (cut
) on the space (-d ' '
) and taking the first result (-f 1
). Then it restarts the whole bunch because thankfully systemctl command allows for multiple services to be passed to it to stop.