HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

systemctl try-restart — Restart one or more units only if they are currently running. More information: <https://www.freedes

Submitted by: @import:tldr-pages··
0
Viewed 0 times
unitscommandrestartsystemctl try-restartclionlymoreone
linux

Problem

How to use the systemctl try-restart command: Restart one or more units only if they are currently running. More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#try-restart%20PATTERN%E2%80%A6>.

Solution

systemctl try-restart — Restart one or more units only if they are currently running. More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#try-restart%20PATTERN%E2%80%A6>.

Restart a specific unit if it is running:
systemctl try-restart {{unit}}


Restart multiple units if they are running:
systemctl try-restart {{unit1 unit2 ...}}


Restart all units matching a pattern if they are running:
systemctl try-restart '{{pattern}}'

Code Snippets

Restart a specific unit if it is running

systemctl try-restart {{unit}}

Restart multiple units if they are running

systemctl try-restart {{unit1 unit2 ...}}

Restart all units matching a pattern if they are running

systemctl try-restart '{{pattern}}'

Context

tldr-pages: linux/systemctl try-restart

Revisions (0)

No revisions yet.