Fixes and updates for FreeBSD

This commit is contained in:
Michiel Broek
2003-01-11 21:46:27 +00:00
parent 29e5616d74
commit 09c514c894
6 changed files with 87 additions and 11 deletions

53
script/init.FreeBSD Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/sh
#
# description: Starts and stops MBSE BBS.
#
# $Id$
#
# /usr/local/etc/rc.d/mbse.sh
#
# 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
export MBSE_ROOT
# See how we were called.
case "$1" in
start)
rm -f ${MBSE_ROOT}/sema/*
rm -f ${MBSE_ROOT}/var/*.LCK
rm -f ${MBSE_ROOT}/tmp/mb*
su mbse -c '${MBSE_ROOT}/bin/mbtask' >/dev/null
echo -n " mbtask"
sleep 2
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
echo ", opened bbs"
fi
;;
stop)
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
echo -n " logoff users"
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
fi
kill -15 `pidof ${MBSE_ROOT}/bin/mbtask`
echo -n " mbtask"
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0