forked from ericflo/cassbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_cassbot
executable file
·37 lines (26 loc) · 1.08 KB
/
run_cassbot
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
#!/bin/bash
if [ "$1" = "-f" ]; then
foreground=1
shift
fi
definition="$1"
[ -r "$definition" ] || { echo "Please specify the bot definition file." >&2; exit 1; }
defdir=$(dirname "$definition")
start_tap="$(dirname "$0")/tap.py"
. "$definition"
[ -z "$twistd" ] && twistd="$(which twistd)" || { echo "Can't find twistd." >&2; exit 1; }
gitver=$(cd "$(dirname "$0")" && git log -n1 --pretty=oneline 2>/dev/null)
if [ -n "$foreground" ]; then
twistd_opts="-n -o"
[ -n "$gitver" ] && echo "STARTING CASSBOT $nickname at $gitver"
elif [ "$logfile" = "<syslog>" ]; then
twistd_opts="--syslog"
else
[ -n "$logfile" ] || logfile="$defdir/cassbot.log"
twistd_opts="--logfile $logfile"
[ -n "$gitver" ] && echo "STARTING CASSBOT $nickname at $gitver" >> "$logfile"
fi
[ -n "$statefile" ] || statefile="$defdir/cassbot.state.db"
[ -n "$pidfile" ] || pidfile="$defdir/cassbot.pid"
export nickname channels server statefile autoload_modules auto_admin jid password jabber_server conference_server
exec "$twistd" $twistd_opts -y "$start_tap" --pidfile "$pidfile" $extra_opts