aports/testing/gmid/gmid.initd
John Vogel 0bbf2d4b3d testing/gmid: fix ssd invocation in initd file
The options for start-stop-daemon do not include a '--pid' option,
but '--pidfile' is valid and makes sense in this instance.
2026-01-12 14:46:19 +01:00

46 lines
1.1 KiB
Bash

#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Copyright 2021 Maxim Karasev <begs@disroot.org>
# Distributed under the terms of the GNU General Public License v2
extra_commands="configtest"
extra_started_commands="reload"
name="gmid"
description="Simple and secure Gemini server"
description_configtest="Run gmid's internal config check."
description_reload="Reload the gmid configuration without losing connections."
supervisor=supervise-daemon
command=/usr/bin/gmid
command_args="-c \"$gmid_config_file\" -P \"$gmid_pid_file\" -f"
depend() {
need net
use dns logger netmount
}
start_pre() {
if [ "${RC_CMD}" != "restart" ]; then
configtest || return 1
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ]; then
configtest || return 1
fi
}
reload() {
configtest || return 1
ebegin "Refreshing gmid's configuration"
start-stop-daemon --signal SIGHUP --pidfile "$gmid_pid_file"
eend $? "Failed to reload gmid"
}
configtest() {
ebegin "Checking gmid's configuration"
${command} -c "${gmid_config_file}" -n
eend $? "failed, please correct errors in the config file"
}