CDIST-TYPE__PROCESS(7)

πŸ’– cdist-type__process(7) πŸ’–

okay bestie so this is a page from cdist β€” the manual name is cdist-type__process, and it's about a type that literally just starts and stops processes for you. no cap. 🫢


✨ NAME ✨

cdist-type__process β€” Start or stop process


🌸 DESCRIPTION 🌸

This cdist type lets you declare the state of a process. That's it. That's the vibe. You say "hey this should be running" or "hey this should NOT be running" and the type goes and makes it so. πŸ‘‘


πŸŽ€ OPTIONAL PARAMETERS πŸŽ€

  • state β€” Either "present" or "absent", and if you don't say anything it defaults to "present". (so by default it's out here trying to keep stuff alive, main character energy fr fr)
  • name β€” the process name you wanna match on when it runs pgrep -f -x. πŸ’…

This one is lowkey important when your name starts with a "/", because cdist strips that leading slash away from the object id. so like, without this, your slash just... vanishes. gone. not me being dramatic, it's literally what happens. πŸ™ˆ

  • stop β€” the executable it should use to stop the process.
  • start β€” the executable it should use to start the process.

πŸ¦‹ MESSAGES πŸ¦‹

  • started β€” The process was started. ✨ (it's giving successful launch)
  • stopped β€” The process was stopped. πŸ’€ (in the good way, the intentional way)

🌈 EXAMPLES 🌈

these are the real ones, copied exactly, don't come for me πŸ’–
# Start if not running
__process /usr/sbin/syslog-ng --state present

# Start if not running with a different binary
__process /usr/sbin/nginx --state present --start "/etc/rc.d/nginx start"

# Stop the process using kill (the type default) - DO NOT USE THIS
__process /usr/sbin/sshd --state absent

# Stop the process using /etc/rc.d/sshd stop - THIS ONE NOT AS WELL
__process /usr/sbin/sshd --state absent --stop "/etc/rc.d/sshd stop"

# Ensure cups is running, which runs with -C ...:
__process cups --start "/etc/rc.d/cups start" --state present \
   --name "/usr/sbin/cupsd -C /etc/cups/cupsd.conf"

# Ensure rpc.statd is running (which usually runs with -L) using a regexp
__process rpcstatd --state present --start "/etc/init.d/statd start" \
    --name "rpc.statd.*"
bestie PLEASE read those comments. two of those examples are literally labeled DO NOT USE THIS and THIS ONE NOT AS WELL. the default kill stop is a no-no, and the /etc/rc.d/sshd stop version is also a no-no. don't do it. i'm not explaining why beyond what the page says, i'm just telling you it's marked as a bad idea. periodt. πŸ’…

also the --name examples are iconic: cups needs the full "/usr/sbin/cupsd -C /etc/cups/cupsd.conf" string because of that -C, and rpcstatd uses a regexp "rpc.statd.*" because of its -L. iykyk. πŸ”₯


⭐ SEE ALSO ⭐


πŸ‘‘ AUTHORS πŸ‘‘

  • Nico Schottelius <nico-cdist--@--schottelius.org>
  • Thomas Eckert <tom--@--it-eckert.de>

πŸ’œ COPYING πŸ’œ

Copyright (C) 2011-2012 Nico Schottelius. 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


and that's the whole page, bestie πŸ’– this was version 7.0.0, dated Jul 31, 2022 β€” shoutout to the cdist crew for keeping our processes in check. slay, stay hydrated, and don't use that default kill stop. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from