Drain and restart systemd queue workers gracefully in bash

# Send SIGTERM to allow running jobs to finish, then restart services
for unit in $(systemctl list-units --type=service --state=running 'app-worker@*.service' --no-legend | awk '{print $1}'); do
    echo "Gracefully restarting $unit..."
    systemctl kill -s SIGTERM ""
    systemctl restart ""
done