1CDIST-TYPE__SYSTEMD_SERVICE(7)       cdist      CDIST-TYPE__SYSTEMD_SERVICE(7)
2
3
4

NAME

6       cdist-type__systemd_service - Controls a systemd service state
7

DESCRIPTION

9       This  type  controls systemd services to define a state of the service,
10       or an action like reloading or restarting. It is  useful  to  reload  a
11       service after configuration applied or shutdown one service.
12
13       The   activation  or  deactivation  is  out  of  scope.  Look  for  the
14       cdist-type__systemd_util(7) type instead.
15

REQUIRED PARAMETERS

17       None.
18

OPTIONAL PARAMETERS

20       name   String which will used as name instead of the object id.
21
22       state  The state which the service should be in:
23
24              running
25                     Service should run (default)
26
27              stopped
28                     Service should be stopped
29
30       action Executes an action on on the service. It will only execute it if
31              the  service  keeps  the  state running. There are following ac‐
32              tions, where:
33
34              reload Reloads the service
35
36              restart
37                     Restarts the service
38

BOOLEAN PARAMETERS

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

MESSAGES

47       start  Started the service
48
49       stop   Stopped the service
50
51       restart
52              Restarted the service
53
54       reload Reloaded the service
55

ABORTS

57       Aborts in following cases:
58
59       systemd or the service does not exist
60

EXAMPLES

62          # service must run
63          __systemd_service nginx
64
65          # service must stopped
66          __systemd_service sshd \
67              --state stopped
68
69          # restart the service
70          __systemd_service apache2 \
71              --action restart
72
73          # makes sure the service exist with an alternative name
74          __systemd_service foo \
75              --name sshd
76
77          # reload the service for a modified configuration file
78          # only reloads the service if the file really changed
79          require="__file/etc/foo.conf" __systemd_service foo \
80              --action reload --if-required
81

AUTHORS

83       Matthias Stecher <matthiasstecher at gmx.de>
84
86       Copyright  (C)  2020  Matthias  Stecher. You can redistribute it and/or
87       modify it under the terms of the GNU General  Public  License  as  pub‐
88       lished  by  the  Free  Software Foundation, either version 3 of the Li‐
89       cense, or (at your option) any later version.
90
92       ungleich GmbH 2020
93
94
95
96
976.9.6                            Apr 20, 2021   CDIST-TYPE__SYSTEMD_SERVICE(7)
Impressum