2011-07-17 03:15:50 +02:00
|
|
|
#!/bin/sh
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2016-05-30 08:20:24 +02:00
|
|
|
# Slackware build script for "bitlbee".
|
|
|
|
|
|
|
|
# Copyright 2007-2016 Michiel van Wessem, Leicester, United Kingdom
|
|
|
|
# Copyright 2016 Marcel Saegebarth <marc@mos6581.de>
|
|
|
|
# Copyright 2016 Avinash H. Duduskar <avinash.duduskar@gmail.com>
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
# /etc/rc.d/rc.bitlbee - Start/stop/restart the bitlbee daemon.
|
|
|
|
# To make bitlbee start automatically at boot, make this
|
2015-08-29 01:32:50 +02:00
|
|
|
# file executable: chmod 0755 /etc/rc.d/rc.bitlbee and add it
|
2011-07-17 03:15:50 +02:00
|
|
|
# to slackware's startup scripts (ie: rc.local)
|
|
|
|
#
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
BITLBEE_CONFIG="/etc/bitlbee/bitlbee.conf"
|
|
|
|
BITLBEE_PORT="6667"
|
|
|
|
BITLBEE_OPTS="-F"
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
PIDFILE="/var/run/bitlbee.pid"
|
|
|
|
SOCKFILE="/var/run/bitlbee.sock"
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
bitlbee_start() {
|
|
|
|
echo "Starting bitlbee on port $BITLBEE_PORT..."
|
2016-05-30 08:20:24 +02:00
|
|
|
CHECK=$(pgrep -u bitlbee -G 250 -l -f "/usr/sbin/bitlbee -u bitlbee -p $BITLBEE_PORT $BITLBEE_OPTS")
|
2011-07-17 03:15:50 +02:00
|
|
|
STATUS=$?
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
# make sure bitlbee isn't running yet
|
|
|
|
if [ "$STATUS" == "1" ]; then
|
|
|
|
touch $PIDFILE
|
|
|
|
chown bitlbee:bitlbee $PIDFILE
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
# Start bitlbee in forked mode.
|
|
|
|
# /usr/sbin/bitlbee -c $BITLBEE_CONFIG # if you have configured bitlbee properly.
|
|
|
|
/usr/sbin/bitlbee -u bitlbee -p $BITLBEE_PORT $BITLBEE_OPTS
|
|
|
|
else
|
|
|
|
echo "bitlbee is already active and running under PID: $(cat $PIDFILE)"
|
|
|
|
echo "if you think this is wrong, remove the offending PID file"
|
|
|
|
echo "and restart bitlbee"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
bitlbee_stop() {
|
|
|
|
echo -n "Stopping bitlbee..."
|
|
|
|
# Are we running a normal daemon or are we forked
|
|
|
|
if [ "$BITLBEE_OPTS" == "-D" ]; then
|
|
|
|
if [ -r $PIDFILE ]; then
|
|
|
|
kill $(cat $PIDFILE)
|
2016-05-30 08:20:24 +02:00
|
|
|
rm $PIDFILE
|
2011-07-17 03:15:50 +02:00
|
|
|
echo "done"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
killall bitlbee
|
2016-05-30 08:20:24 +02:00
|
|
|
rm $PIDFILE
|
2011-07-17 03:15:50 +02:00
|
|
|
echo "done"
|
|
|
|
fi
|
|
|
|
}
|
2015-08-29 01:32:50 +02:00
|
|
|
|
2011-07-17 03:15:50 +02:00
|
|
|
# Let's see how we are being called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
bitlbee_start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
bitlbee_stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
bitlbee_stop
|
2015-08-29 01:32:50 +02:00
|
|
|
sleep 3
|
|
|
|
bitlbee_start
|
2011-07-17 03:15:50 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $(basename $0) {start|stop|restart}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|