CDIST-TYPE__SYSTEMD_SERVICE(7)

πŸ’… cdist-type__systemd_service β€” the manual page, but make it cute ✨

okay bestie, so this is cdist-type__systemd_service from the cdist manual set, and it is literally the girlboss of service management. let's get into it πŸŽ€


✨ NAME ✨

cdist-type__systemd_service β€” controls a systemd service state πŸ‘‘


🌸 DESCRIPTION 🌸

so this type controls systemd services, right? it sets a state on a service, or it fires off an action like reloading or restarting. super useful for reloading a service after you've applied config, or for shutting one service down. πŸ’–

⚠️ but listen β€” the activation or deactivation is out of scope, bestie. that's not this type's job. if that's what you need, go look at the cdist-type__systemd_util(7) type instead. iykyk πŸ¦‹

πŸ’œ REQUIRED PARAMETERS πŸ’œ

None. zero. nada. nothing is required, she's low maintenance fr fr ✨


πŸŽ€ OPTIONAL PARAMETERS πŸŽ€

  • name β€” a string that gets used as the name instead of the object id. so you can call her whatever you want πŸ’…
  • state β€” the state the service should be in, and the options are:
    • running β€” service should run. this is the default btw πŸ‘‘
    • stopped β€” service should be stopped πŸ’€
  • action β€” executes an action on the service. and here's the tea: it will only execute it if the service keeps the state running. the actions are:
    • reload β€” reloads the service πŸ¦‹
    • restart β€” restarts the service πŸ”₯

🌈 BOOLEAN PARAMETERS 🌈

  • if-required β€” only execute the action if at minimum one required type outputs a message to $__messages_out. through this, the action should only be executed if a dependency actually did something. and no cap: the action will not be executed if no dependencies are given 🫢

⭐ MESSAGES ⭐

  • start β€” started the service ✨
  • stop β€” stopped the service
  • restart β€” restarted the service πŸ”₯
  • reload β€” reloaded the service πŸ¦‹

πŸ’€ ABORTS πŸ’€

it aborts in the following cases, and bestie it's dramatic:

  • systemd or the service does not exist 😭

🧚 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="__file/etc/foo.conf" __systemd_service foo \
    --action reload --if-required

πŸ‘‘ AUTHORS πŸ‘‘

Matthias Stecher <matthiasstecher at gmx.de> β€” we stan 🫢


Copyright (C) 2020 Matthias Stecher. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


ungleich GmbH 2021


okay and that's a wrap, my love 🌸 this was cdist version 7.0.0, dated Jul 31, 2022, from the CDIST-TYPE__SYSTEMD_SERVICE(7) page β€” slay, ate, no crumbs left, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from