This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
deb-mbse/mbsebbs-code-361e3323ef16e6d9c51e83748a5843a3b34b7f64/script/init.Gentoo
vbcoen 6a6a253885 Updated mbmon.c & mbsetup.c
Added doc dir. and manual as .pdf
restored deleted files - yep I screwed the pooch.
2015-11-03 20:41:11 +00:00

75 lines
1.5 KiB
Plaintext

#!/sbin/runscript
#
# $Id: init.Gentoo,v 1.9 2007/07/09 18:46:51 mbse Exp $
#
# description: Starts and stops the MBSE BBS.
#
# For Gentoo GNU/Linux (by Capitán X).
# Find the MBSE_ROOT from the /etc/passwd file.
MBSE_ROOT=`cat /etc/passwd | grep ^mbse: | awk -F ':' '{ print $6}'`
if [ "${MBSE_ROOT}" = "" ]; then
echo "MBSE BBS: No 'mbse' user in the password file."
exit 1
fi
if [ ! -d ${MBSE_ROOT} ]; then
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
exit 1
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin:${MBSE_ROOT}/bin
DAEMON=${MBSE_ROOT}/bin/mbtask
NAME=mbsebbs
DESC="MBSE BBS"
export MBSE_ROOT
depend() {
use net xinetd
need localmount
}
start() {
ebegin "Starting mbse"
rm -f ${MBSE_ROOT}/var/run/*
rm -f ${MBSE_ROOT}/var/sema/*
rm -f ${MBSE_ROOT}/var/*.LCK
rm -f ${MBSE_ROOT}/tmp/mb*
su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null
sleep 2
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
fi
eend $? "Loading error."
}
stop() {
ebegin "Stopping mbse"
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`
i=10
doit=1
while let 'i > 0' && let 'doit != 0'
do
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
echo -n "."
sleep 1
let i=i-1
else
doit=0
fi
done
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
fi
fi
eend $? "Stopping error."
}