Skip to content

Instantly share code, notes, and snippets.

@theratman
Created January 17, 2023 19:43
Show Gist options
  • Save theratman/a33936cbd509edbdc02890ea9dc7443c to your computer and use it in GitHub Desktop.
Save theratman/a33936cbd509edbdc02890ea9dc7443c to your computer and use it in GitHub Desktop.
Converting Observium xinetd service to systemd
cat << EOF > /etc/systemd/system/observium_agent\@.service
[Unit]
Description=Observium Agent Service
After=network.target observium_agent.socket
Requires=observium_agent.socket
[Service]
Type=simple
User=root
# Note the - to make systemd ignore the exit code
ExecStart=-/usr/bin/observium_agent
# This is the part that makes it work like inetd
StandardOutput=socket
[Install]
WantedBy=multi-user.target
EOF
cat << EOF > /etc/systemd/system/observium_agent.socket
[Install]
WantedBy = sockets.target
[Unit]
Description=Observium Agent Socket
PartOf=observium_agent.service
[Socket]
ListenStream=36602
Accept=yes
[Install]
WantedBy=sockets.target
EOF
systemctl daemon-reload
systemctl enable observium_agent.socket
systemctl start observium_agent.socket
@theratman
Copy link
Author

Tested on Rocky Linux 9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment