Changed init scripts to start after a power failure
This commit is contained in:
parent
f645f1a8e6
commit
32300e69df
@ -8,6 +8,9 @@ v0.39.5 24-Dec-2003
|
||||
|
||||
script:
|
||||
Fixed NetBSD init script
|
||||
All init scripts now clean the ~/var/run directory and start
|
||||
the bbs allways so that the bbs will try to start after a power
|
||||
failure.
|
||||
|
||||
|
||||
v0.39.4 08-Dec-2003 - 24-Dec-2003
|
||||
|
@ -1,7 +1,15 @@
|
||||
$Id$
|
||||
|
||||
|
||||
MBSE BBS Script files.
|
||||
|
||||
If you want to make any changes to the scripts, do it here and not in the
|
||||
~/etc and ~/bin directories. After making the changes do a 'make install'
|
||||
as root and the scripts are in place with the right permissions and owners.
|
||||
|
||||
Also, if you use a distribution which is not supported here and want to
|
||||
have it added, then send the file installinit.log found in this directory,
|
||||
SETUP.log (if exists) from the mbse main directory and a possible written
|
||||
inew init script you may have written.
|
||||
|
||||
Michiel
|
||||
|
@ -31,9 +31,7 @@ export MBSE_ROOT
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $DESC: "
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
echo "already running"
|
||||
else
|
||||
rm -f $MBSE_ROOT/var/run/*
|
||||
rm -f $MBSE_ROOT/sema/*
|
||||
rm -f $MBSE_ROOT/var/*.LCK
|
||||
rm -f $MBSE_ROOT/tmp/mb*
|
||||
@ -45,7 +43,6 @@ case "$1" in
|
||||
echo -n "opened "
|
||||
fi
|
||||
echo "done."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
|
@ -10,13 +10,13 @@
|
||||
# Find the MBSE_ROOT from the /etc/passwd file.
|
||||
MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]
|
||||
if [ "${MBSE_ROOT}" = "" ]
|
||||
then
|
||||
echo "MBSE BBS: No 'mbse' user in the password file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $MBSE_ROOT ]
|
||||
if [ ! -d ${MBSE_ROOT} ]
|
||||
then
|
||||
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
|
||||
exit 1
|
||||
@ -27,7 +27,7 @@ export MBSE_ROOT
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
if [ ! -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
rm -f ${MBSE_ROOT}/sema/*
|
||||
rm -f ${MBSE_ROOT}/var/*.LCK
|
||||
rm -f ${MBSE_ROOT}/tmp/mb*
|
||||
@ -38,28 +38,27 @@ case "$1" in
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo -n ", opened bbs"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
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`
|
||||
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
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "."
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "."
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
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`
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
|
||||
fi
|
||||
echo -n " done"
|
||||
fi
|
||||
|
@ -10,18 +10,18 @@
|
||||
|
||||
MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]; then
|
||||
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."
|
||||
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
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:${MBSE_ROOT}/bin
|
||||
DAEMON=${MBSE_ROOT}/bin/mbtask
|
||||
NAME=mbsebbs
|
||||
DESC="MBSE BBS"
|
||||
|
||||
@ -34,14 +34,15 @@ depend() {
|
||||
start() {
|
||||
|
||||
ebegin "Starting mbse"
|
||||
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
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
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'
|
||||
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo -n "opened "
|
||||
fi
|
||||
eend $? "Loading error."
|
||||
@ -51,16 +52,16 @@ start() {
|
||||
stop() {
|
||||
|
||||
ebegin "Stopping mbse"
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "logoff users "
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
|
||||
echo -n " stopping mbtask"
|
||||
kill `cat $MBSE_ROOT/var/run/mbtask`
|
||||
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
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "."
|
||||
sleep 1
|
||||
let i=i-1
|
||||
@ -68,8 +69,8 @@ stop() {
|
||||
doit=0
|
||||
fi
|
||||
done
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
kill -9 `cat $MBSE_ROOT/var/run/mbtask`
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
|
||||
fi
|
||||
fi
|
||||
eend $? "Stopping error."
|
||||
|
@ -39,7 +39,7 @@ mbsebbs_start()
|
||||
|
||||
export MBSE_ROOT
|
||||
|
||||
if [ ! -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
rm -f ${MBSE_ROOT}/sema/*
|
||||
rm -f ${MBSE_ROOT}/var/*.LCK
|
||||
rm -f ${MBSE_ROOT}/tmp/mb*
|
||||
@ -50,11 +50,9 @@ mbsebbs_start()
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo ", opened bbs"
|
||||
fi
|
||||
else
|
||||
echo " is already running"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
mbsebbs_stop()
|
||||
{
|
||||
echo -n "Stopping mbsebbs:"
|
||||
@ -77,7 +75,7 @@ mbsebbs_stop()
|
||||
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n " logoff users"
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
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
|
||||
|
@ -18,15 +18,15 @@
|
||||
# Find the MBSE_ROOT from the /etc/passwd file.
|
||||
MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]
|
||||
if [ "${MBSE_ROOT}" = "" ]
|
||||
then
|
||||
echo "MBSE BBS: No 'mbse' user in the password file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $MBSE_ROOT ]
|
||||
if [ ! -d ${MBSE_ROOT} ]
|
||||
then
|
||||
echo "MBSE BBS: Home directory '$MBSE_ROOT' not found."
|
||||
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -67,27 +67,24 @@ fi
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting MBSE BBS: "
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
echo "already started"
|
||||
else
|
||||
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
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
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'
|
||||
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
|
||||
$SU mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo "opened"
|
||||
fi
|
||||
touch /var/lock/subsys/mbsed
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down MBSE BBS: "
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "logoff users "
|
||||
$SU mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
$SU mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
|
||||
echo -n "done, "
|
||||
echo -n "stop mbtask: "
|
||||
killproc mbtask -15
|
||||
|
@ -10,15 +10,15 @@
|
||||
# Find the MBSE_ROOT from the /etc/passwd file.
|
||||
MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]
|
||||
if [ "${MBSE_ROOT}" = "" ]
|
||||
then
|
||||
echo "MBSE BBS: No 'mbse' user in the password file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $MBSE_ROOT ]
|
||||
if [ ! -d ${MBSE_ROOT} ]
|
||||
then
|
||||
echo "MBSE BBS: Home directory '$MBSE_ROOT' not found."
|
||||
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -28,32 +28,29 @@ export MBSE_ROOT
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "MBSE BBS starting:"
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
echo " already started"
|
||||
else
|
||||
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
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
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'
|
||||
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo " and opened the bbs."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "MBSE BBS shutdown:"
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n " logoff users "
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
|
||||
echo -n "done, stopping mbtask"
|
||||
kill -15 `cat $MBSE_ROOT/var/run/mbtask`
|
||||
kill -15 `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
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n "."
|
||||
sleep 1
|
||||
let i=i-1
|
||||
@ -61,8 +58,8 @@ case "$1" in
|
||||
doit=0
|
||||
fi
|
||||
done
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
kill -9 `cat $MBSE_ROOT/var/run/mbtask`
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
kill -9 `cat ${MBSE_ROOT}/var/run/mbtask`
|
||||
fi
|
||||
echo " done."
|
||||
else
|
||||
@ -71,10 +68,10 @@ case "$1" in
|
||||
;;
|
||||
status)
|
||||
echo -n "MBSE BBS status: "
|
||||
if [ ! -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ ! -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo "mbtask is NOT running"
|
||||
else
|
||||
echo "mbtask running with pid `cat $MBSE_ROOT/var/run/mbtask`"
|
||||
echo "mbtask running with pid `cat ${MBSE_ROOT}/var/run/mbtask`"
|
||||
fi
|
||||
;;
|
||||
restart|reload)
|
||||
|
@ -14,15 +14,15 @@
|
||||
# Find the MBSE_ROOT from the /etc/passwd file.
|
||||
MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]
|
||||
if [ "${MBSE_ROOT}" = "" ]
|
||||
then
|
||||
echo "MBSE BBS: No 'mbse' user in the password file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $MBSE_ROOT ]
|
||||
if [ ! -d ${MBSE_ROOT} ]
|
||||
then
|
||||
echo "MBSE BBS: Home directory '$MBSE_ROOT' not found."
|
||||
echo "MBSE BBS: Home directory '${MBSE_ROOT}' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -31,31 +31,26 @@ export MBSE_ROOT
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "MBSE BBS starting:"
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
echo " already started"
|
||||
else
|
||||
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
|
||||
rm -f ${MBSE_ROOT}/var/run/*
|
||||
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'
|
||||
if [ -f ${MBSE_ROOT}/etc/config.data ]; then
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat open -quiet'
|
||||
echo " and opened the bbs."
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "MBSE BBS shutdown:"
|
||||
if [ -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo -n " logoff users "
|
||||
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||
su mbse -c '${MBSE_ROOT}/bin/mbstat close wait -quiet' >/dev/null
|
||||
echo -n "done,"
|
||||
echo -n " stopping mbtask "
|
||||
killproc `cat $MBSE_ROOT/var/run/mbtask` -15
|
||||
killproc `cat ${MBSE_ROOT}/var/run/mbtask` -15
|
||||
sleep 3
|
||||
echo "done."
|
||||
else
|
||||
@ -68,7 +63,7 @@ case "$1" in
|
||||
;;
|
||||
status)
|
||||
echo -n "MBSE BBS status: "
|
||||
if [ ! -f $MBSE_ROOT/var/run/mbtask ]; then
|
||||
if [ ! -f ${MBSE_ROOT}/var/run/mbtask ]; then
|
||||
echo "mbtask is NOT running"
|
||||
else
|
||||
echo "mbtask Ok"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# Installation script to install bootscripts.
|
||||
#
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:$MBSE_ROOT/bin
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:${MBSE_ROOT}/bin
|
||||
DISTNAME=
|
||||
DISTVERS=
|
||||
DISTINIT=
|
||||
@ -39,7 +39,7 @@ EOF
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$MBSE_ROOT" = "" ]; then
|
||||
if [ "${MBSE_ROOT}" = "" ]; then
|
||||
echo "*** The MBSE_ROOT doesn't exist ***"
|
||||
log "!" "Aborted, MBSE_ROOT variable doesn't exist"
|
||||
exit 2
|
||||
@ -154,9 +154,9 @@ if [ "$DISTNAME" = "Slackware" ]; then
|
||||
log "+" "Adding SystemV Slackware $DISTVERS MBSE BBS start/stop scripts"
|
||||
cp init.Slackware $DISTINIT
|
||||
chmod 755 $DISTINIT
|
||||
if [ -f $MBSE_ROOT/bin/mbse.start ]; then
|
||||
if [ -f ${MBSE_ROOT}/bin/mbse.start ]; then
|
||||
echo "Removing old startup scripts"
|
||||
rm $MBSE_ROOT/bin/mbse.start $MBSE_ROOT/bin/mbse.stop $MBSE_ROOT/etc/rc $MBSE_ROOT/etc/rc.shutdown
|
||||
rm ${MBSE_ROOT}/bin/mbse.start ${MBSE_ROOT}/bin/mbse.stop ${MBSE_ROOT}/etc/rc ${MBSE_ROOT}/etc/rc.shutdown
|
||||
fi
|
||||
if [ -d /var/log/setup ]; then
|
||||
cp setup.mbse /var/log/setup
|
||||
|
Reference in New Issue
Block a user