Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created November 9, 2021 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordansissel/81c208f945812f004020e70f0818e8e2 to your computer and use it in GitHub Desktop.
Save jordansissel/81c208f945812f004020e70f0818e8e2 to your computer and use it in GitHub Desktop.
pleaserun systemd service extraction with jq
% pleaserun --json /usr/bin/mgmt | jq -r '.files[] | select(.path | match("service$")) | .content'
No platform selected. Autodetecting... {:platform=>"systemd", :version=>"(245.4-4ubuntu3.11)", :level=>:warn}
No name given, setting reasonable default based on the executable {:name=>"mgmt", :level=>:warn}
[Unit]
Description=no description given
[Service]
Type=simple
User=root
Group=root
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/mgmt
EnvironmentFile=-/etc/sysconfig/mgmt
ExecStart=/usr/bin/mgmt
Restart=always
WorkingDirectory=/
# When stopping, how long to wait before giving up and sending SIGKILL?
# Keep in mind that SIGKILL on a process can cause data loss.
TimeoutStopSec=infinity
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment