a71e00b9464b236c6b5748cbe0b7fd6502f16d0e / dev-util/ramsleuth-bin/files/ramsleuth.initd · 1566 bytes · raw
#!/sbin/openrc-run
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# RamSleuth daemon — OpenRC port of upstream's systemd/ramsleuth.service.
#
# Privilege model: the daemon runs as root (group ramsleuth) and only needs
# CAP_SYS_RAWIO (/dev/ryzen_smu + /dev/mem MCHBAR); OpenRC has no capability
# clamp, so root simply holds it. Missing privileges are a SOFT degrade
# (fields report N/A), never a crash. Live AMD subtimings additionally want
# the ryzen_smu module loaded (`modprobe ryzen_smu`) before the daemon.
description="RamSleuth privileged memory telemetry and benchmark daemon"
description_doc="https://github.com/MadGoatHaz/RamSleuth"
: ${RAMSLEUTH_DAEMON_ARGS:="--socket /run/ramsleuth/ramsleuth.sock"}
: ${RAMSLEUTH_GROUP:=ramsleuth}
command="/usr/bin/ramsleuth-daemon"
command_args="${RAMSLEUTH_DAEMON_ARGS}"
# root:ramsleuth mirrors the upstream unit's User=root / Group=ramsleuth.
command_user="root:${RAMSLEUTH_GROUP}"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"
# The unit's journal output, landed on files instead.
redir_stdout="/var/log/ramsleuth.out"
redir_stderr="/var/log/ramsleuth.err"
depend() {
need localmount
after bootmisc
use logger
}
start_pre() {
# The unit's RuntimeDirectory=ramsleuth (root:Group 0755) — created before
# the daemon starts so it never has to touch /run itself.
checkpath --directory --owner root:"${RAMSLEUTH_GROUP}" --mode 0755 /run/ramsleuth || return 1
checkpath --directory --owner root:root --mode 0755 /var/log || return 1
}