updated on Wed Jan 11 00:07:16 UTC 2012
[aur-mirror.git] / xchat-bttrw-svn / init-script
blob91a158919ef53f07828435406e069e18239674a6
1 #!/bin/bash
3 [ -f /etc/conf.d/xchat-bttrw ] && . /etc/conf.d/xchat-bttrw
5 . /etc/rc.conf
6 . /etc/rc.d/functions
8 PID=`pidof -o %PPID /usr/bin/xchat-bttrw`
10 case "$1" in
11 start)
12 stat_busy "Starting xchat-bttrw"
13 PARAMS=""
15 if [ -z "$PORT" ]; then
16 # msg "You must set PORT variable in /etc/conf.d/xchat-bttrw!"
17 stat_fail
18 exit
19 else
20 PARAMS="$PARAMS --port $PORT"
23 if [ "$PROXYHOST" ] && [ "$PROXYPORT" ]; then
24 # msg "Using proxu $PROXYHOST:$PROXYPORT"
25 export PROXYHOST="$PROXYHOST"
26 export PROXYPORT="$PROXYPORT"
29 if [ "$BIND" ]; then PARAMS="$PARAMS --bind $BIND"; fi
30 if [ "$LOG" ]; then PARAMS="$PARAMS --log $LOG"; fi
31 if [ "$RESTRICT" ]; then
32 PARAMS="$PARAMS --resctrict $RESTRICT"
35 /usr/bin/xchat-bttrw $PARAMS &> /dev/null &
37 if [ $? -gt 0 ]; then
38 stat_fail
39 else
40 add_daemon xchat-bttrw
41 stat_done
44 stop)
45 stat_busy "Stopping xchat-bttrw"
46 [ ! -z "$PID" ] && kill $PID &> /dev/null
48 if [ $? -gt 0 ]; then
49 stat_fail
50 else
51 rm_daemon xchat-bttrw
52 stat_done
55 stopall)
56 $0 stop
57 killall xchat-bttrw
59 restart)
60 $0 stop
61 sleep 1
62 $0 start
65 echo "usage: $0 {start|stop|stopall|restart}"
66 esac
67 exit 0