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.NetBSD
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

110 lines
2.1 KiB
Bash

#!/bin/sh
#
# $Id: init.NetBSD,v 1.6 2007/07/09 18:46:51 mbse Exp $
#
# PROVIDE: mbsebbs
# REQUIRE: root beforenetlkm mountcritlocal tty
# it does not really require beforenetlkm.
. /etc/rc.subr
name="mbsebbs"
rcvar=$name
start_cmd="mbsebbs_start"
stop_cmd="mbsebbs_stop"
reload_cmd="mbsebbs_reload"
extra_commands="reload"
mbsebbs_start()
{
echo -n "Starting mbsebbs:"
# 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 " no 'mbse' user in the password file."
return
fi
if [ ! -d ${MBSE_ROOT} ]
then
echo " home directory '${MBSE_ROOT}' not found."
return
fi
export MBSE_ROOT
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 2>&1
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
}
mbsebbs_stop()
{
echo -n "Stopping mbsebbs:"
# 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 " no 'mbse' user in the password file."
return
fi
if [ ! -d ${MBSE_ROOT} ]
then
echo " home directory '${MBSE_ROOT}' not found."
return
fi
export MBSE_ROOT
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
echo -n " logoff users"
su mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
kill -15 `cat ${MBSE_ROOT}/var/run/mbtask`
sleep 1
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
echo -n "."
sleep 1
fi
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
echo -n "."
sleep 1
fi
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
echo -n "."
sleep 1
fi
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
fi
echo " done"
else
echo " was not running"
fi
}
mbsebbs_reload()
{
mbsebbs_stop
mbsebbs_start
}
load_rc_config $name
run_rc_command "$1"