3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 11:59:40 +01:00

Created debian (markdown)

Zaher Dirkey 2018-02-21 23:41:42 +02:00
parent c943e01255
commit 4a9219ded9

102
debian.md Normal file

@ -0,0 +1,102 @@
```init
#!/bin/sh
#
# https://github.com/oragono/oragono
#
# this file based on https://github.com/jirihnidek/daemon
#
# For install oragono as service in Debian/Ubuntu
#
# Install(unzip) oragono into /opt/oragono directory, and do installation instructors of oragono
# Copy oragono.init file into /etc/init.d
#
# /etc/init.d/oragono.init
# chmod +x oragono
# service oragono.init start
#
# ref:
# https://serverfault.com/questions/135859/is-there-a-standard-way-to-make-daemon-in-debian
# https://stackoverflow.com/questions/8124345/call-to-daemon-in-a-etc-init-d-script-is-blocking-not-running-in-background
# http://big-elephants.com/2013-01/writing-your-own-init-scripts/
# https://chris-lamb.co.uk/posts/start-stop-daemon-exec-vs-startas
#
### BEGIN INIT INFO
# Provides: oragono
# Required-Start: $rsyslog
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop of Oragono
# Description: Oragono irc server
### END INIT INFO
# Source function library.
. /lib/lsb/init-functions
prog="oragono"
app_dir="/opt/$prog"
app="$app_dir/$prog" #no need to change
conf_file="/opt/$prog/ircd.yaml"
options="run --conf $conf_file --quiet"
lock_file="/var/lock/subsys/$prog"
pid_file="/var/run/$prog.pid"
log_file="/var/log/$prog.log"
proguser=root
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
start() {
[ -x $exec ] || exit 5
echo -n $"Starting $prog:\n"
start-stop-daemon --start --quiet --oknodo --background -m --pidfile $pid_file --chdir $app_dir --exec $app -- $options
RETVAL=$?
return $RETVAL
}
stop() {
echo -n $"Stopping $prog:\n"
start-stop-daemon --stop --quiet --oknodo --pidfile $pid_file
RETVAL=$?
return $RETVAL
}
restart() {
stop
start
}
rh_status() {
#not fixed yet
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
#rh_status_q && exit 0
$1
;;
stop)
#rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
#not tested, needs to fix
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $?
```