first commit

This commit is contained in:
Blake Ridgway
2026-04-11 14:06:59 -05:00
commit ba1770b493
21 changed files with 2027 additions and 0 deletions

51
rc.d/cyclingbot Normal file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
#
# PROVIDE: cyclingbot
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Add the following to /etc/rc.conf inside your jail to enable:
# cyclingbot_enable="YES"
. /etc/rc.subr
name="cyclingbot"
rcvar="cyclingbot_enable"
desc="Cycling Discord Bot"
command="/usr/local/bin/cycling-bot"
pidfile="/var/run/${name}.pid"
cyclingbot_enable="${cyclingbot_enable:-NO}"
cyclingbot_user="cyclingbot"
cyclingbot_chdir="/var/db/cyclingbot"
# Use daemon(8) to daemonize the process and write a pidfile
start_cmd="${name}_start"
stop_cmd="${name}_stop"
cyclingbot_start()
{
echo "Starting ${desc}."
/usr/sbin/daemon \
-u "${cyclingbot_user}" \
-p "${pidfile}" \
-o /var/log/cyclingbot.log \
/bin/sh -c "cd ${cyclingbot_chdir} && exec ${command}"
}
cyclingbot_stop()
{
echo "Stopping ${desc}."
if [ ! -f "${pidfile}" ]; then
echo "${name} is not running."
return 0
fi
pid=$(cat "${pidfile}")
kill -TERM "${pid}" 2>/dev/null
wait_for_pids "${pid}"
rm -f "${pidfile}"
}
load_rc_config "${name}"
run_rc_command "$1"