Changed init scripts
This commit is contained in:
parent
8d4311b6a3
commit
d1c532d1ca
@ -1,11 +1,11 @@
|
|||||||
# Makefile for MBSE BBS under Linux
|
# Makefile for MBSE BBS under Linux
|
||||||
# Copyright (c) 1998, 2001 by M. Broek.
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
include ../Makefile.global
|
include ../Makefile.global
|
||||||
|
|
||||||
OTHER = Makefile README maint midnight weekly monthly installinit.sh rc rc.shutdown \
|
OTHER = Makefile README maint midnight weekly monthly installinit.sh rc rc.shutdown \
|
||||||
mbse.start mbse.stop bbsdoor.sh rundoor.sh
|
mbse.start mbse.stop bbsdoor.sh rundoor.sh init.Debian init.RedHat \
|
||||||
|
init.Slackware init.SuSE
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
|
64
script/init.Debian
Normal file
64
script/init.Debian
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Note: this is not 100% Debian style, at least it works for now.
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# description: Starts and stops the MBSE BBS.
|
||||||
|
#
|
||||||
|
# For Debian SYSV init style.
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# See how we were called.
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting $DESC: "
|
||||||
|
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 -n "opened "
|
||||||
|
fi
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Stopping $DESC: "
|
||||||
|
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
|
||||||
|
start-stop-daemon --stop --signal 15 --user mbtask
|
||||||
|
echo "$NAME done."
|
||||||
|
;;
|
||||||
|
force-reload|restart)
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
N=/etc/init.d/$NAME
|
||||||
|
echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
exit 0
|
105
script/init.RedHat
Normal file
105
script/init.RedHat
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# chkconfig: 345 95 05
|
||||||
|
# description: Starts and stops MBSE BBS.
|
||||||
|
#
|
||||||
|
# For RedHat, E-Smith and Mandrake SYSV init style.
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
# Source networking configuration.
|
||||||
|
. /etc/sysconfig/network
|
||||||
|
|
||||||
|
# Check that networking is up.
|
||||||
|
[ ${NETWORKING} = "no" ] && exit 1
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
SU="su"
|
||||||
|
#
|
||||||
|
# From RedHat version 6.1 and up the behaviour of "su" has changed.
|
||||||
|
# Extra tests are added for the RedHat e-smith server distribution,
|
||||||
|
# this is a special distribution based on RedHat.
|
||||||
|
# For Mandrake we follow the same behaviour.
|
||||||
|
#
|
||||||
|
if [ -f /etc/mandrake-release ]; then
|
||||||
|
#
|
||||||
|
# Mandrake 6.0 and newer, use "su -"
|
||||||
|
#
|
||||||
|
RHR="`cat /etc/mandrake-release | awk '{ print $4 }' | tr -d .`"
|
||||||
|
if [ $RHR -gt 60 ]; then
|
||||||
|
SU="su -"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
if [ -z "`grep e-smith /etc/redhat-release`" ]; then
|
||||||
|
# Standard RedHat
|
||||||
|
RHR=`cat /etc/redhat-release | awk '{ print $5 }' | tr -d .`
|
||||||
|
else
|
||||||
|
# E-Smith server based on RedHat
|
||||||
|
RHR=`cat /etc/redhat-release | awk '{ print $13 }' | tr -d . | tr -d \)`
|
||||||
|
fi
|
||||||
|
if [ $RHR -gt 60 ]; then
|
||||||
|
SU="su -"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# See how we were called.
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting MBSE BBS: "
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
touch /var/lock/subsys/mbsed
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Shutting down MBSE BBS: "
|
||||||
|
if [ -f $MBSE_ROOT/etc/config.data ]; then
|
||||||
|
echo -n "logoff users "
|
||||||
|
$SU mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||||
|
echo -n "done, "
|
||||||
|
fi
|
||||||
|
echo -n "stop mbtask: "
|
||||||
|
killproc mbtask -15
|
||||||
|
rm -f /var/lock/subsys/mbsed
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status mbsed
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|reload|status}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
exit 0
|
69
script/init.Slackware
Normal file
69
script/init.Slackware
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# description: Starts and stops MBSE BBS.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# /etc/rc.d/init.d for Slackware
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
echo -n "MBSE BBS starting:"
|
||||||
|
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 " and opened the bbs."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "MBSE BBS shutdown:"
|
||||||
|
if [ -f $MBSE_ROOT/etc/config.data ]; then
|
||||||
|
echo -n " logoff users "
|
||||||
|
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||||
|
echo -n "done,"
|
||||||
|
fi
|
||||||
|
echo -n " stopping mbtask "
|
||||||
|
kill -15 `pidof $MBSE_ROOT/bin/mbtask`
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
echo -n "MBSE BBS status: "
|
||||||
|
if [ "`/sbin/pidof mbtask`" = "" ]; then
|
||||||
|
echo "mbtask is NOT running"
|
||||||
|
else
|
||||||
|
echo "mbtask Ok"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|reload|restart|status}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
exit 0
|
68
script/init.SuSE
Normal file
68
script/init.SuSE
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# /sbin/init.d/mbsed for SuSE
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "MBSE BBS starting:"
|
||||||
|
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 " and opened the bbs."
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "MBSE BBS shutdown:"
|
||||||
|
if [ -f $MBSE_ROOT/etc/config.data ]; then
|
||||||
|
echo -n " logoff users "
|
||||||
|
su mbse -c '$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
||||||
|
echo -n "done,"
|
||||||
|
fi
|
||||||
|
echo -n " stopping mbtask "
|
||||||
|
killproc $MBSE_ROOT/bin/mbtask -15
|
||||||
|
echo "done."
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
echo -n "MBSE BBS status: "
|
||||||
|
if [ "`/sbin/pidof mbtask`" = "" ]; then
|
||||||
|
echo "mbtask is NOT running"
|
||||||
|
else
|
||||||
|
echo "mbtask Ok"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|status|reload|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
exit 0
|
@ -147,79 +147,8 @@ if [ "$DISTNAME" = "SuSE" ]; then
|
|||||||
echo "Installing SystemV init scripts for SuSE"
|
echo "Installing SystemV init scripts for SuSE"
|
||||||
log "+" "Installing SystemV init scripts for SuSE"
|
log "+" "Installing SystemV init scripts for SuSE"
|
||||||
echo "Adding $DISTINIT"
|
echo "Adding $DISTINIT"
|
||||||
|
cp init.SuSE $DISTINIT
|
||||||
cat << EOF >$DISTINIT
|
chmod 755 $DISTINIT
|
||||||
#!/bin/bash
|
|
||||||
# Copyright (c) 2001 Michiel Broek
|
|
||||||
#
|
|
||||||
# Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001
|
|
||||||
#
|
|
||||||
# $DISTINIT for SuSE
|
|
||||||
#
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
case "\$1" in
|
|
||||||
start|reload)
|
|
||||||
echo -n "MBSE BBS starting:"
|
|
||||||
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 " and opened the bbs."
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo -n "MBSE BBS shutdown:"
|
|
||||||
if [ -f \$MBSE_ROOT/etc/config.data ]; then
|
|
||||||
echo -n " logoff users "
|
|
||||||
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
|
||||||
echo -n "done,"
|
|
||||||
fi
|
|
||||||
echo -n " stopping mbtask "
|
|
||||||
killproc \$MBSE_ROOT/bin/mbtask -15
|
|
||||||
echo "done."
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
echo "Restarting MBSE BBS: just kidding!"
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
echo -n "MBSE BBS status: "
|
|
||||||
if [ "\`/sbin/pidof mbtask\`" = "" ]; then
|
|
||||||
echo "mbtask is NOT running"
|
|
||||||
else
|
|
||||||
echo "mbtask Ok"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: \$0 {start|stop|status|reload|restart}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
exit 0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod 755 /etc/rc.d/init.d/mbsed
|
|
||||||
echo "Making links for start/stop in runlevel 2"
|
echo "Making links for start/stop in runlevel 2"
|
||||||
ln -s ../mbsed /sbin/init.d/rc2.d/K05mbsed
|
ln -s ../mbsed /sbin/init.d/rc2.d/K05mbsed
|
||||||
ln -s ../mbsed /sbin/init.d/rc2.d/S99mbsed
|
ln -s ../mbsed /sbin/init.d/rc2.d/S99mbsed
|
||||||
@ -272,78 +201,7 @@ if [ "$DISTNAME" = "Slackware" ]; then
|
|||||||
echo "Adding SystemV Slackware MBSE BBS start/stop scripts"
|
echo "Adding SystemV Slackware MBSE BBS start/stop scripts"
|
||||||
log "+" "Adding SystemV Slackware MBSE BBS start/stop scripts"
|
log "+" "Adding SystemV Slackware MBSE BBS start/stop scripts"
|
||||||
checkrcdir
|
checkrcdir
|
||||||
|
cp init.Slackware $DISTINIT
|
||||||
cat << EOF >$DISTINIT
|
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# description: Starts and stops MBSE BBS.
|
|
||||||
#
|
|
||||||
# Author: Michiel Broek <mbse@users.sourceforge.net>, 23-May-2001
|
|
||||||
#
|
|
||||||
# $DISTINIT for Slackware
|
|
||||||
#
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
echo -n "MBSE BBS starting:"
|
|
||||||
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 " and opened the bbs."
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo -n "MBSE BBS shutdown:"
|
|
||||||
if [ -f \$MBSE_ROOT/etc/config.data ]; then
|
|
||||||
echo -n " logoff users "
|
|
||||||
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
|
||||||
echo -n "done,"
|
|
||||||
fi
|
|
||||||
echo -n " stopping mbtask "
|
|
||||||
kill -15 \`pidof \$MBSE_ROOT/bin/mbtask\`
|
|
||||||
echo "done."
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
echo -n "MBSE BBS status: "
|
|
||||||
if [ "\`/sbin/pidof mbtask\`" = "" ]; then
|
|
||||||
echo "mbtask is NOT running"
|
|
||||||
else
|
|
||||||
echo "mbtask Ok"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
echo "Restarting MBSE BBS: just kidding!"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: mbsed {start|stop|restart|status}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
EOF
|
|
||||||
chmod 755 $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"
|
echo "Removing old startup scripts"
|
||||||
@ -382,119 +240,25 @@ if [ "$DISTNAME" = "RedHat" ] || [ "$DISTNAME" = "Mandrake" ]; then
|
|||||||
|
|
||||||
log "+" "Adding RedHat/E-Smith/Mandrake SystemV init scripts"
|
log "+" "Adding RedHat/E-Smith/Mandrake SystemV init scripts"
|
||||||
DISTINIT="/etc/rc.d/init.d/mbsed"
|
DISTINIT="/etc/rc.d/init.d/mbsed"
|
||||||
SU="su"
|
|
||||||
#
|
#
|
||||||
# From RedHat version 6.1 and up the behaviour of "su" has changed.
|
|
||||||
# Extra tests are added for the RedHat e-smith server distribution,
|
# Extra tests are added for the RedHat e-smith server distribution,
|
||||||
# this is a special distribution based on RedHat.
|
# this is a special distribution based on RedHat.
|
||||||
# For Mandrake we follow the same behaviour.
|
|
||||||
#
|
#
|
||||||
if [ -f /etc/mandrake-release ]; then
|
if [ -f /etc/mandrake-release ]; then
|
||||||
RHR="`cat /etc/mandrake-release | awk '{ print $4 }' | tr -d .`"
|
|
||||||
RHN="Mandrake"
|
RHN="Mandrake"
|
||||||
if [ $RHR -gt 60 ]; then
|
|
||||||
echo "You are running Mandrake v6.1 or newer"
|
|
||||||
SU="su -"
|
|
||||||
else
|
|
||||||
echo "You are running Mandrake v6.0 or older"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
if [ -z "`grep e-smith /etc/redhat-release`" ]; then
|
if [ -z "`grep e-smith /etc/redhat-release`" ]; then
|
||||||
RHR=`cat /etc/redhat-release | awk '{ print $5 }' | tr -d .`
|
|
||||||
RHN="RedHat"
|
RHN="RedHat"
|
||||||
else
|
else
|
||||||
RHR=`cat /etc/redhat-release | awk '{ print $13 }' | tr -d . | tr -d \)`
|
|
||||||
RHN="e-smith based on RedHat"
|
RHN="e-smith based on RedHat"
|
||||||
fi
|
fi
|
||||||
if [ $RHR -gt 60 ]; then
|
|
||||||
echo "You are running $RHN v6.1 or newer"
|
|
||||||
SU="su -"
|
|
||||||
else
|
|
||||||
echo "You are running $RHN v6.0 or older"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "You are in big trouble."
|
echo "You are in big trouble."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Adding startup file $DISTINIT"
|
echo "Adding startup file $DISTINIT"
|
||||||
|
cp init.RedHat $DISTINIT
|
||||||
cat << EOF >$DISTINIT
|
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# chkconfig: 345 95 05
|
|
||||||
# description: Starts and stops MBSE BBS.
|
|
||||||
#
|
|
||||||
# For RedHat, E-Smith and Mandrake SYSV init style.
|
|
||||||
# 20-Jan-2002 M. Broek
|
|
||||||
#
|
|
||||||
# Source function library.
|
|
||||||
. /etc/rc.d/init.d/functions
|
|
||||||
|
|
||||||
# Source networking configuration.
|
|
||||||
. /etc/sysconfig/network
|
|
||||||
|
|
||||||
# Check that networking is up.
|
|
||||||
[ \${NETWORKING} = "no" ] && exit 1
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
echo -n "Starting MBSE BBS: "
|
|
||||||
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"
|
|
||||||
fi
|
|
||||||
touch /var/lock/subsys/mbsed
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo -n "Shutting down MBSE BBS: "
|
|
||||||
if [ -f \$MBSE_ROOT/etc/config.data ]; then
|
|
||||||
echo -n "logoff users "
|
|
||||||
$SU mbse -c '\$MBSE_ROOT/bin/mbstat close wait -quiet' >/dev/null
|
|
||||||
echo -n "done, "
|
|
||||||
fi
|
|
||||||
echo -n "stop mbtask: "
|
|
||||||
killproc mbtask -15
|
|
||||||
rm -f /var/lock/subsys/mbsed
|
|
||||||
echo "done."
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
status mbsed
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
echo "Restarting MBSE BBS: just kidding!"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: mbsed {start|stop|restart|status}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
EOF
|
|
||||||
chmod 755 $DISTINIT
|
chmod 755 $DISTINIT
|
||||||
echo "Making links for stop in runlevels 0 and 6"
|
echo "Making links for stop in runlevels 0 and 6"
|
||||||
if [ -f /etc/rc.d/rc0.d/K05mbsed ]; then
|
if [ -f /etc/rc.d/rc0.d/K05mbsed ]; then
|
||||||
@ -534,73 +298,7 @@ if [ "$DISTNAME" = "Debian" ]; then
|
|||||||
echo "You are running Debian Linux $DISTVERS"
|
echo "You are running Debian Linux $DISTVERS"
|
||||||
log "+" "Adding Debian SystemV init script"
|
log "+" "Adding Debian SystemV init script"
|
||||||
DISTINIT="/etc/init.d/mbsebbs"
|
DISTINIT="/etc/init.d/mbsebbs"
|
||||||
|
cp init.Debian $DISTINIT
|
||||||
cat << EOF >$DISTINIT
|
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Note: this is not 100% Debian style, at least it works for now.
|
|
||||||
# 23-May-2001 Michiel Broek.
|
|
||||||
#
|
|
||||||
# description: Starts and stops the MBSE BBS.
|
|
||||||
|
|
||||||
# For Debian SYSV init style.
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# See how we were called.
|
|
||||||
case "\$1" in
|
|
||||||
start)
|
|
||||||
echo -n "Starting \$DESC: "
|
|
||||||
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 -n "opened "
|
|
||||||
fi
|
|
||||||
echo "done."
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo -n "Stopping \$DESC: "
|
|
||||||
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
|
|
||||||
start-stop-daemon --stop --signal 15 --user mbtask
|
|
||||||
echo "\$NAME done."
|
|
||||||
;;
|
|
||||||
force-reload|restart)
|
|
||||||
echo "Restarting \$DESC: is not possible, done."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
N=/etc/init.d/\$NAME
|
|
||||||
echo "Usage: \$N {start|stop|restart|force-reload}" >&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
EOF
|
|
||||||
chmod 755 $DISTINIT
|
chmod 755 $DISTINIT
|
||||||
update-rc.d mbsebbs defaults
|
update-rc.d mbsebbs defaults
|
||||||
echo "Debian install ready."
|
echo "Debian install ready."
|
||||||
@ -615,7 +313,7 @@ fi
|
|||||||
#
|
#
|
||||||
if [ "$DISTNAME" = "FreeBSD" ] || [ "$DISTNAME" = "NetBSD" ]; then
|
if [ "$DISTNAME" = "FreeBSD" ] || [ "$DISTNAME" = "NetBSD" ]; then
|
||||||
#
|
#
|
||||||
# FreeBSD init
|
# FreeBSD, NetBSD init
|
||||||
#
|
#
|
||||||
DISTINIT="$MBSE_ROOT/etc/rc"
|
DISTINIT="$MBSE_ROOT/etc/rc"
|
||||||
echo "Adding $DISTNAME style MBSE BBS start/stop scripts"
|
echo "Adding $DISTNAME style MBSE BBS start/stop scripts"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# ~/bin/mbse.start
|
|
||||||
# BBS Startup script, should be run as BBS owner.
|
# BBS Startup script, should be run as BBS owner.
|
||||||
# Note: This is only used on Slackware systems until 7.0.0 and FreeBSD
|
# Note: This is only used on Slackware systems until 7.0.0, FreeBSD and NetBSD.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
#
|
#
|
||||||
# 25-Oct-2001 MB.
|
|
||||||
|
|
||||||
if [ "$MBSE_ROOT" = "" ]; then
|
if [ "$MBSE_ROOT" = "" ]; then
|
||||||
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# ~/bin/mbse.start
|
|
||||||
# BBS Shutdown script, should be run as BBS owner.
|
# BBS Shutdown script, should be run as BBS owner.
|
||||||
# Note: this is only used on Slackware and FreeBSD systems.
|
# Note: this is only used on old Slackware, FreeBSD and NetBSD systems.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
#
|
#
|
||||||
# 13-Aug-2001 MB.
|
|
||||||
|
|
||||||
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:$MBSE_ROOT/bin:"
|
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:$MBSE_ROOT/bin:"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# MBSE BBS Midnight - Should be run from cron at 00:00
|
# MBSE BBS Midnight - Should be run from cron at 00:00
|
||||||
#
|
#
|
||||||
# 26-Aug-1999 MB.
|
# $Id$
|
||||||
|
|
||||||
if [ "$MBSE_ROOT" = "" ]; then
|
if [ "$MBSE_ROOT" = "" ]; then
|
||||||
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# MBSE BBS Monthly - Should be run at the first of the month at 00:10
|
# MBSE BBS Monthly - Should be run at the first of the month at 00:10
|
||||||
#
|
#
|
||||||
# 26-Aug-1999 MB.
|
# $Id$
|
||||||
|
|
||||||
if [ "$MBSE_ROOT" = "" ]; then
|
if [ "$MBSE_ROOT" = "" ]; then
|
||||||
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $MBSE_ROOT/etc/rc: BBS Startup script for Slackware and FreeBSD
|
# $MBSE_ROOT/etc/rc: BBS Startup script for old Slackware, FreeBSD and NetBSD
|
||||||
#
|
#
|
||||||
# 13-Aug-2001
|
# $Id$
|
||||||
|
|
||||||
# Remove stale tempfiles from cron.
|
# Remove stale tempfiles from cron.
|
||||||
rm -f /tmp/cron.mbse.*
|
rm -f /tmp/cron.mbse.*
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# /opt/mbse/etc/rc.shutdown: BBS Shutdown script for Slackware and FreeBSD
|
# /opt/mbse/etc/rc.shutdown: BBS Shutdown script for Slackware, FreeBSD and NetBSD.
|
||||||
#
|
#
|
||||||
# 13-Aug-2001
|
# $Id$
|
||||||
|
|
||||||
if [ "$MBSE_ROOT" = "" ]; then
|
if [ "$MBSE_ROOT" = "" ]; then
|
||||||
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# MBSE BBS Weekly - Should be run every week at sunday from cron at 00:05
|
# MBSE BBS Weekly - Should be run every week at sunday from cron at 00:05
|
||||||
#
|
#
|
||||||
# 26-Aug-1999 MB.
|
# $Id$
|
||||||
|
|
||||||
if [ "$MBSE_ROOT" = "" ]; then
|
if [ "$MBSE_ROOT" = "" ]; then
|
||||||
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
export MBSE_ROOT=`cat /etc/passwd | grep mbse: | awk -F ':' '{ print $6}'`
|
||||||
|
Reference in New Issue
Block a user