-
Notifications
You must be signed in to change notification settings - Fork 1
/
Pantherbot.sh
56 lines (50 loc) · 1.57 KB
/
Pantherbot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# This assumes you have:
# 1) A user called `hubot` in charge of the bot.
# 2) A file called /home/hubot/.hubotrc that contains the Hubot credentials.
#
# To set the adapter either edit bin/hubot to specify what you want or append
# `-- -a campfire` to the $DAEMON variable below.
#
### BEGIN INIT INFO
# Provides: hubot
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the hubot service
# Description: starts the Hubot bot for the Campfire rooms
### END INIT INFO
PATH=/home/PantherBot/node_modules/hubot/bin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME="PantherBot"
HUBOT_HOME="/home/harshagoli/PantherBot"
LOGFILE="/var/log/hubot/hubot.log"
PIDFILE="/var/run/hubot.pid"
DAEMON="$HUBOT_HOME/bin/hubot -- -a slack"
set -e
case "$1" in
start)
echo -n "Starting $NAME: "
. /home/PantherBot/.hubotrc
start-stop-daemon --start --quiet --pidfile $PIDFILE -c hubot:hubot --make-pidfile --background --exec $DAEMON
echo "."
;;
stop)
echo -n "Stopping $NAME: "
start-stop-daemon --stop --quiet --pidfile $PIDFILE
echo "."
;;
restart)
echo -n "Restarting $NAME: "
. /home/PantherBot/.hubotrc
start-stop-daemon --stop --quiet --pidfile $PIDFILE
start-stop-daemon --start --quiet --pidfile $PIDFILE -c hubot:hubot --make-pidfile --background --exec $DAEMON
echo "."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit