agirbot/resources/scripts/daemon.sh

24 lines
504 B
Bash
Raw Normal View History

2012-09-08 18:03:18 +02:00
#!/bin/sh
NAME=hebdobot
BASE_DIR=$HOME/$NAME
PID_FILE=$BASE_DIR/$NAME.pid
DAEMON=java
2017-12-25 00:29:57 +01:00
DAEMON_ARGS="-cp *:lib/* org.april.hebdobot"
2012-09-08 18:03:18 +02: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