2017-12-24 11:22:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Required-Start: $remote_fs $syslog $local_fs $network
|
|
|
|
# Required-Stop: $remote_fs $syslog $local_fs $network
|
|
|
|
# Default-Start:
|
|
|
|
# Default-Stop:
|
|
|
|
# Provides: Hebdobot
|
|
|
|
# Short-Description: Bot de revue hebdo April
|
|
|
|
# Description: hebdobot est un bot irc écrit en java
|
|
|
|
### END INIT INFO
|
|
|
|
|
2018-05-19 16:55:14 +02:00
|
|
|
export LANG=fr_FR.UTF8
|
2017-12-24 11:22:31 +01:00
|
|
|
NAME=hebdobot
|
|
|
|
BASE_DIR=/srv/$NAME
|
|
|
|
PID_FILE=$BASE_DIR/$NAME.pid
|
|
|
|
DAEMON=$(which java)
|
2018-01-10 03:59:21 +01:00
|
|
|
DAEMON_ARGS="-jar bin/hebdobot.jar -c conf/hebdobot.conf"
|
2017-12-24 11:22:31 +01:00
|
|
|
|
|
|
|
CMD="/sbin/start-stop-daemon --chdir $BASE_DIR --quiet --make-pidfile --pidfile $PID_FILE --exec $DAEMON"
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo "Starting $NAME"
|
|
|
|
$CMD --start --test || exit 1
|
|
|
|
$CMD --start --background -- $DAEMON_ARGS || exit 2
|
|
|
|
echo "$NAME started"
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo "Stopping $NAME"
|
|
|
|
$CMD --stop || exit 3
|
|
|
|
rm -f $PID_FILE
|
|
|
|
echo "$NAME stopped"
|
|
|
|
;;
|
|
|
|
esac
|