[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: missing "shutdown" command, substitutes?



On Mon, Jan 01, 2001 at 08:24:00PM +0100, martin.stenzel@rz.hu-berlin.de wrote:
> the Linux "sysvinit" package contains the
> "shutdown" command.
> There is no "sysvinit" package for the
> Hurd since things are done differently
> here.

Hi Martin,

I suspect that it is cron (or atd) blocking the way for a clean filesystem at
shutdown (it's cron (or atd) which prevents to remount the filesystem
read-only after booting, that's why I suspect that.

Please try out the attached script, which should do the job for now.
It doesn't expect a time argument, so don't provide one. It's quite dumb,
and by no means a full replacement for a proper init/shutdown.

If it works for you, let me know. I will add it to the Debian package then.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de
#! /bin/sh

if [ -z "$1" ] ; then
    echo "$0: too few arguments"
    echo "Usage: $0 OPTION" 1>&2
    echo "Try \`$0 --help' for more information." 1>&2
    exit 1
fi

if [ ! -z "$2" ] ; then
    echo "$0: too many arguments"
    echo "Usage: $0 OPTION" 1>&2
    echo "Try \`$0 --help' for more information." 1>&2
    exit 1
fi

case "$1" in
  -h|--halt)
    action=/sbin/halt
    ;;

  -r|--reboot)
    action=/sbin/reboot
    ;;

  --help)
    echo "Usage:  $0 OPTION"
    echo "Shut down the system."
    echo
    echo "Options are:"
    echo "  -h, --halt    Halt the system after shutdown"
    echo "  -r, --reboot  Reboot the system after shutdown"
    echo "      --help    Display this help and exit"
    echo "      --version Output version information and exit"
    echo
    echo "Send bug reports to <bug-hurd@gnu.org>."
    exit 0
    ;;

  --version)
    echo "shutdown (GNU Hurd) 0.1"
    exit 0
    ;;

  --usage)
    echo "Usage: $0 OPTION"
    echo "Try \`$0 --help' for more information."
    exit 0
    ;;

  *)
    echo "$0: unrecognized option \`$1'"
    echo "Usage: $0 OPTION" 1>&2
    echo "Try \`$0 --help' for more information." 1>&2
    exit 1
    ;;
esac

# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP

for i in /etc/rc6.d/K[0-9][0-9]*
  do
    # Check if the script is there.
    [ ! -f $i ] && continue

    # Stop the service.
    sh $i stop
  done

$action

Reply to: