Recipes

Server maintenance

Restart a remote systemd service with approval

Require operator acknowledgement, restart a service over SSH, and verify that it becomes active.

Supported platforms

LinuxmacOSWindows

Prerequisites

  • SSH key authentication and known-host verification
  • Permission to run systemctl for the selected service

Workflow YAML

description: Restart a remote systemd service after explicit operator acknowledgement.

params:
  - name: host
    default: server.example.com
  - name: user
    default: deploy
  - name: service
    default: app.service
  - name: key
    default: ~/.ssh/id_ed25519

steps:
  - id: confirm
    action: human.task
    with:
      prompt: Acknowledge the restart of ${params.service} on ${params.host}

  - id: restart
    depends: [confirm]
    action: ssh.run
    with:
      host: ${params.host}
      user: ${params.user}
      key: ${params.key}
      command: sudo systemctl restart '${params.service}'

  - id: verify
    depends: [restart]
    action: ssh.run
    with:
      host: ${params.host}
      user: ${params.user}
      key: ${params.key}
      command: systemctl is-active '${params.service}'
    retry_policy:
      limit: 5
      interval_sec: 5

Review before running

Replace example values, configure the listed secrets, and review every command for your environment. Syntax validation does not make a community workflow trusted.

Running this workflow with a team?

The Team plan adds SSO, role-based access, audit logs, incident routing, and priority support for three self-hosted Dagu servers. Start a 14-day trial without a credit card.

Start Team trial
View sourceInstall DaguContributed by @dagucloud · validated with Dagu 2.13.0

Related Recipes