| 1 |
#!/bin/sh
|
| 2 |
#
|
| 3 |
# /etc/rc.d/rc.bnetd
|
| 4 |
#
|
| 5 |
# Copyright (C) 2003 rakware@go.ro
|
| 6 |
# BSD style RC startup script
|
| 7 |
# start/stop/restart the pvpgn Battle.net emulator.
|
| 8 |
#
|
| 9 |
# to make bnetd start automatically at boot, make this
|
| 10 |
# file executable: chmod +x /etc/rc.d/rc.bnetd
|
| 11 |
# also make sure that your rc.local script executes it
|
| 12 |
#
|
| 13 |
# 30.10.2003
|
| 14 |
# added sleep 3 to bnetd_up(down) so pidof can do
|
| 15 |
# the work right
|
| 16 |
|
| 17 |
bnetd_up() {
|
| 18 |
sleep 3;
|
| 19 |
if `echo `pidof bnetd`` >>/dev/null; then
|
| 20 |
echo "OK"
|
| 21 |
else
|
| 22 |
echo "FAILED"
|
| 23 |
fi
|
| 24 |
}
|
| 25 |
|
| 26 |
bnetd_down() {
|
| 27 |
sleep 3;
|
| 28 |
if `echo `pidof bnetd`` >>/dev/null; then
|
| 29 |
echo "FAILED"
|
| 30 |
else
|
| 31 |
echo "OK"
|
| 32 |
fi
|
| 33 |
}
|
| 34 |
|
| 35 |
bnetd_start() {
|
| 36 |
if [ -x /usr/local/sbin/bnetd -a -r /usr/local/bnetd/etc/bnetd.conf ]; then
|
| 37 |
/usr/local/sbin/bnetd
|
| 38 |
echo -n "starting pvpgn... : "; bnetd_up
|
| 39 |
fi
|
| 40 |
}
|
| 41 |
|
| 42 |
bnetd_stop() {
|
| 43 |
killall -9 bnetd
|
| 44 |
echo -n "killing pvpgn... : "; bnetd_down
|
| 45 |
}
|
| 46 |
|
| 47 |
bnetd_restart() {
|
| 48 |
bnetd_stop
|
| 49 |
sleep 3
|
| 50 |
bnetd_start
|
| 51 |
}
|
| 52 |
|
| 53 |
bnetd_status() {
|
| 54 |
if `echo `pidof bnetd`` >>/dev/null; then
|
| 55 |
echo "pvpgn is UP and running"
|
| 56 |
else
|
| 57 |
echo "pvpgn is NOT running"
|
| 58 |
fi
|
| 59 |
}
|
| 60 |
|
| 61 |
case "$1" in
|
| 62 |
'start')
|
| 63 |
bnetd_start
|
| 64 |
;;
|
| 65 |
'stop')
|
| 66 |
bnetd_stop
|
| 67 |
;;
|
| 68 |
'restart')
|
| 69 |
bnetd_restart
|
| 70 |
;;
|
| 71 |
'status')
|
| 72 |
bnetd_status
|
| 73 |
;;
|
| 74 |
*)
|
| 75 |
# Default is "start", for backwards compatibility with previous
|
| 76 |
# Slackware versions. This may change to a 'usage' error someday.
|
| 77 |
|
| 78 |
bnetd_start
|
| 79 |
esac
|