Skip to content

Commit

Permalink
Add openrc service and it's config file
Browse files Browse the repository at this point in the history
Signed-off-by: Rahil Bhimjiani <[email protected]>
  • Loading branch information
rahilarious committed Mar 16, 2024
1 parent 4ef50ed commit b758adc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contrib/openrc/prometheus-podman-exporter.confd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Config file for /etc/init.d/prometheus-podman-exporter

# Configure the user[:group] the podman will run as
#RUN_AS_USER="root:root"

PODMAN_EXPORTER_OPTS="--collector.enable-all"
24 changes: 24 additions & 0 deletions contrib/openrc/prometheus-podman-exporter.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/sbin/openrc-run

description="Prometheus exporter for podman (v4) machine"

command_user="${RUN_AS_USER:-root:root}"
command="/usr/bin/prometheus-podman-exporter"
command_args="${PODMAN_EXPORTER_OPTS}"
command_background="true"
extra_started_commands="reload"

pidfile="/run/${RC_SVCNAME}.pid"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.log"

reload() {
if ! service_started "${RC_SVCNAME}" ; then
eerror "${RC_SVCNAME} isn't running"
return 1
fi

ebegin "Reloading ${RC_SVCNAME} service"
pkill -HUP -F "${pidfile}"
eend $? "Reloading ${RC_SVCNAME} service failed."
}

0 comments on commit b758adc

Please sign in to comment.