| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Init script for the ergo IRCd |
| 4 |
# Created 14/06/2021 by [email protected] |
| 5 |
# Desgigned for and tested on Slackware -current |
| 6 |
# Depends on `daemon` (installable using slackpkg) |
| 7 |
# 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) |
| 8 |
|
| 9 |
NAME=ergo |
| 10 |
DIR=/opt/ergo |
| 11 |
ERGO=/ergo |
| 12 |
DAEMONIZER=/usr/bin/daemon |
| 13 |
CONFIG=ircd.yaml |
| 14 |
USER=ergo |
| 15 |
GROUP=ergo |
| 16 |
|
| 17 |
daemon_start() { |
| 18 |
$DAEMONIZER -n $NAME -v -- chroot --userspec=$USER --groups=$USER -- $DIR $ERGO run --conf $CONFIG |
| 19 |
} |
| 20 |
|
| 21 |
daemon_stop() { |
| 22 |
$DAEMONIZER --stop -n $NAME -v |
| 23 |
} |
| 24 |
|
| 25 |
daemon_restart() { |
| 26 |
$DAEMONIZER --restart -n $NAME -v |
| 27 |
} |
| 28 |
|
| 29 |
daemon_reload() { |
| 30 |
$DAEMONIZER --signal=SIGHUP -n $NAME -v |
| 31 |
} |
| 32 |
|
| 33 |
daemon_status() { |
| 34 |
$DAEMONIZER --running -n $NAME -v |
| 35 |
} |
| 36 |
|
| 37 |
case "$1" in |
| 38 |
start) |
| 39 |
daemon_start |
| 40 |
;; |
| 41 |
stop) |
| 42 |
daemon_stop |
| 43 |
;; |
| 44 |
restart) |
| 45 |
daemon_restart |
| 46 |
;; |
| 47 |
reload) |
| 48 |
daemon_reload |
| 49 |
;; |
| 50 |
status) |
| 51 |
daemon_status |
| 52 |
;; |
| 53 |
*) |
| 54 |
echo "Source: https://github.com/ergochat/ergo" |
| 55 |
echo "Usage: $0 {start|stop|restart|reload|status}" |
| 56 |
exit 1 |
| 57 |
esac |