#! /bin/sh #---------------------------------------------------------------------------- # /etc/rc - resource control script # # Creation : 2001-08-07 fm # Last Update: $Id$ # # Copyright (c) 2001-2012 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- runlevel=$1 trap "echo" 2 # catch interrupts PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin; export PATH . /etc/init.d/functions echo boot_mesg " * Running $0 ..." if [ "$PREVLEVEL" = "$RUNLEVEL" ] then exit 0 fi boot_mesg " * Switching from runlevel $PREVLEVEL to $RUNLEVEL ..." curdir=/etc/rc$RUNLEVEL.d prevdir=/etc/rc$PREVLEVEL.d rex="[0-9][0-9]" if [ $RUNLEVEL = 0 -o $RUNLEVEL = 6 ] then echo "System is going down now!" | /usr/bin/wall 2>/dev/null fi #---------------------------------------------------------------------------- # previous runlevel: kill jobs #---------------------------------------------------------------------------- for i in $prevdir/K* do if [ -x "$i" ] then # don't run the kill script, if the new runlevel has a start script script=`echo $i | sed "s#$prevdir/K$rex##"` script=`eval echo "$curdir/S$rex$script"` if [ ! -f "$script" ] then $i stop fi fi done #---------------------------------------------------------------------------- # new runlevel: start jobs #---------------------------------------------------------------------------- for i in $curdir/S* do if [ -x "$i" ] then # don't run start script, if previous runlevel had a kill script script=`echo $i | sed "s#$prevdir/S$rex##"` script=`eval echo "$curdir/S$rex$script"` if [ ! -f "$script" ] then $i start fi fi done exit 0