welcomebot/init.d.deprecated/welcomebot

50 lines
1.1 KiB
Bash
Executable File

#! /bin/sh
#
### BEGIN INIT INFO
# Provides: welcomebot
# Required-Start: $remote_fs $syslog $local_fs $network
# Required-Stop: $remote_fs $syslog $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bot irc de l'April.
# Description: welcomebt est un bot irc, il est ici installé pour son pluging
# MeetBot qui sert à réaliser des rapports de réunion.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/srv/welcomebot/git/bot.sh
NAME=welcomebot
DESC=welcomebot
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid \
--chuid welcomebot --exec $DAEMON -- --daemon $DAEMON \
|| return 2
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
rm -f /var/run/$NAME.pid
pkill -9 -f bot.py
echo "$NAME."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit 0