+
+ +
+

16.145. cdist-type__systemd-service(7)ΒΆ

+
+

16.145.1. NAMEΒΆ

+

cdist-type__systemd-service - Controls a systemd service state

+
+
+

16.145.2. DESCRIPTIONΒΆ

+

This type controls systemd services to define a state of the service, +or an action like reloading or restarting. It is useful to reload a +service after configuration applied or shutdown one service.

+

The activation or deactivation is out of scope. Look for the +cdist-type__systemd_util(7) type instead.

+
+
+

16.145.3. REQUIRED PARAMETERSΒΆ

+

None.

+
+
+

16.145.4. OPTIONAL PARAMETERSΒΆ

+
+
name
+
String which will used as name instead of the object id.
+
state
+

The state which the service should be in:

+
+
running
+
Service should run (default)
+
stoppend
+
Service should stopped
+
+
+
action
+

Executes an action on on the service. It will only execute it if the +service keeps the state running. There are following actions, where:

+
+
reload
+
Reloads the service
+
restart
+
Restarts the service
+
+
+
+
+
+

16.145.5. BOOLEAN PARAMETERSΒΆ

+
+
if-required
+
Only execute the action if minimum one required type outputs a message to +$__messages_out. Through this, the action should only executed if a +dependency did something. The action will not executed if no dependencies +given.
+
+
+
+

16.145.6. MESSAGESΒΆ

+
+
start
+
Started the service
+
stop
+
Stopped the service
+
restart
+
Restarted the service
+
reload
+
Reloaded the service
+
+
+
+

16.145.7. ABORTSΒΆ

+

Aborts in following cases:

+

systemd or the service does not exist

+
+
+

16.145.8. EXAMPLESΒΆ

+
# service must run
+__systemd_service nginx
+
+# service must stopped
+__systemd_service sshd \
+    --state stopped
+
+# restart the service
+__systemd_service apache2 \
+    --action restart
+
+# makes sure the service exist with an alternative name
+__systemd_service foo \
+    --name sshd
+
+# reload the service for a modified configuration file
+# only reloads the service if the file really changed
+require="__config_file/etc/foo.conf" __systemd_service foo \
+    --action reload --if-required
+
+
+
+
+

16.145.9. AUTHORSΒΆ

+

Matthias Stecher <matthiasstecher at gmx.de>

+
+ +
+ + +
+ +