2003-11-10 19:06:32 +00:00
|
|
|
|
#!/sbin/runscript
|
|
|
|
|
#
|
|
|
|
|
# $Id$
|
|
|
|
|
#
|
|
|
|
|
# description: Starts and stops the MBSE BBS.
|
|
|
|
|
#
|
|
|
|
|
# For Gentoo GNU/Linux (by Capit<69>n X).
|
|
|
|
|
|
|
|
|
|
# Find the MBSE_ROOT from the /etc/passwd file.
|
|
|
|
|
|
2007-07-09 18:46:51 +00:00
|
|
|
|
MBSE_ROOT=`cat /etc/passwd | grep ^mbse: | awk -F ':' '{ print $6}'`
|
2003-11-10 19:06:32 +00:00
|
|
|
|
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ "${MBSE_ROOT}" = "" ]; then
|
2003-11-10 19:06:32 +00:00
|
|
|
|
echo "MBSE BBS: No 'mbse' user in the password file."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ ! -d ${MBSE_ROOT} ]; then
|
|
|
|
|
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
|
2003-11-10 19:06:32 +00:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2003-12-26 11:28:15 +00:00
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:${MBSE_ROOT}/bin
|
|
|
|
|
DAEMON=${MBSE_ROOT}/bin/mbtask
|
2003-11-10 19:06:32 +00:00
|
|
|
|
NAME=mbsebbs
|
|
|
|
|
DESC="MBSE BBS"
|
|
|
|
|
|
|
|
|
|
export MBSE_ROOT
|
|
|
|
|
|
|
|
|
|
depend() {
|
2004-09-26 11:27:23 +00:00
|
|
|
|
use net xinetd
|
2003-11-10 19:06:32 +00:00
|
|
|
|
need localmount
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start() {
|
|
|
|
|
|
|
|
|
|
ebegin "Starting mbse"
|
2003-12-26 11:28:15 +00:00
|
|
|
|
rm -f ${MBSE_ROOT}/var/run/*
|
2004-09-14 20:37:57 +00:00
|
|
|
|
rm -f ${MBSE_ROOT}/var/sema/*
|
2003-12-26 11:28:15 +00:00
|
|
|
|
rm -f ${MBSE_ROOT}/var/*.LCK
|
|
|
|
|
rm -f ${MBSE_ROOT}/tmp/mb*
|
|
|
|
|
su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null
|
2003-11-10 19:06:32 +00:00
|
|
|
|
sleep 2
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
|
|
|
|
|
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
2003-11-10 19:06:32 +00:00
|
|
|
|
fi
|
|
|
|
|
eend $? "Loading error."
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
|
|
2003-12-06 20:52:58 +00:00
|
|
|
|
ebegin "Stopping mbse"
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
|
|
|
|
su mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
|
|
|
|
|
kill `cat ${MBSE_ROOT}/var/run/mbtask`
|
2003-12-06 20:52:58 +00:00
|
|
|
|
i=10
|
|
|
|
|
doit=1
|
|
|
|
|
while let 'i > 0' && let 'doit != 0'
|
|
|
|
|
do
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
2003-12-06 20:52:58 +00:00
|
|
|
|
echo -n "."
|
|
|
|
|
sleep 1
|
|
|
|
|
let i=i-1
|
|
|
|
|
else
|
|
|
|
|
doit=0
|
|
|
|
|
fi
|
|
|
|
|
done
|
2003-12-26 11:28:15 +00:00
|
|
|
|
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
|
|
|
|
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
|
2003-12-06 20:52:58 +00:00
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
eend $? "Stopping error."
|
2003-11-10 19:06:32 +00:00
|
|
|
|
}
|