From ca99a65dc4abea25084f6f5a22f156d1838e9fc7 Mon Sep 17 00:00:00 2001 From: cranberry Date: Mon, 14 Jun 2021 11:28:35 +0000 Subject: [PATCH] Submitting rc.ergo /etc/rc.d/rc.ergo --- distrib/init/rc.ergo | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 distrib/init/rc.ergo diff --git a/distrib/init/rc.ergo b/distrib/init/rc.ergo new file mode 100644 index 00000000..c1455b80 --- /dev/null +++ b/distrib/init/rc.ergo @@ -0,0 +1,57 @@ +#!/bin/sh + +# Init script for the ergo IRCd +# Created 14/06/2021 by georg@lysergic.dev +# Desgigned for and tested on Slackware -current +# Depends on `daemon` (installable using slackpkg) +# In its stock configuration ergo will be jailed to /opt/ergo - all paths are relative from there. Consider this in your ergo configuration file (i.e. certificate, database and log locations) + +NAME=ergo +DIR=/opt/ergo +ERGO=/ergo +DAEMONIZER=/usr/bin/daemon +CONFIG=ircd.yaml +USER=ergo +GROUP=ergo + +daemon_start() { + $DAEMONIZER -n $NAME -v -- chroot --userspec=$USER --groups=$USER -- $DIR $ERGO run --conf $CONFIG +} + +daemon_stop() { + $DAEMONIZER --stop -n $NAME -v +} + +daemon_restart() { + $DAEMONIZER --restart -n $NAME -v +} + +daemon_reload() { + $DAEMONIZER --signal=SIGHUP -n $NAME -v +} + +daemon_status() { + $DAEMONIZER --running -n $NAME -v +} + +case "$1" in + start) + daemon_start + ;; + stop) + daemon_stop + ;; + restart) + daemon_restart + ;; + reload) + daemon_reload + ;; + status) + daemon_status + ;; + *) + echo "Source: https://github.com/ergochat/ergo" + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 +esac