LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-05-2004, 10:44 AM   #1
Darkenedes
Member
 
Registered: Jul 2004
Location: Pittsburgh, PA
Distribution: : Slackware 10
Posts: 31

Rep: Reputation: 15
shutdown/reboot ACPI problem


I did a search for this but didn't find what I was looking for.

I just compiled a kernel with ACPI support built in so my machine would power down after a system halt. The problem is, it also powers down after a reboot as well (both su - reboot and ctrl+alt+delete). I want shutdown -h to turn off my PC, so how can I get reboot/ctrl+alt+del to actually just restart my machine?

Last edited by Darkenedes; 09-05-2004 at 10:58 AM.
 
Old 09-06-2004, 07:23 AM   #2
Darkenedes
Member
 
Registered: Jul 2004
Location: Pittsburgh, PA
Distribution: : Slackware 10
Posts: 31

Original Poster
Rep: Reputation: 15
This is my rc.6 script, I wouldn't know what to change to fix it:

Code:
#! /bin/sh
#
# rc.6          This file is executed by init when it goes into runlevel
#               0 (halt) or runlevel 6 (reboot). It kills all processes,
#               unmounts file systems and then either halts or reboots.
#
# Version:      @(#)/etc/rc.d/rc.6      2.47 Sat Jan 13 13:37:26 PST 2001
#
# Author:       Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by:  Patrick J. Volkerding, <volkerdi@slackware.com>
#

# Set the path.
PATH=/sbin:/etc:/bin:/usr/bin

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

# Set linefeed mode to avoid staircase effect.
stty onlcr

echo "Running shutdown script $0:"

# Find out how we were called.
case "$0" in
        *0)
                command="halt"
                ;;
        *6)
                command=reboot
                ;;
        *)
                echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
                exit 1
                ;;
esac

# Save the system time to the hardware clock using hwclock --systohc.
if [ -x /sbin/hwclock ]; then
  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
    echo "Saving system time to the hardware clock (UTC)."
    /sbin/hwclock --utc --systohc
  else
    echo "Saving system time to the hardware clock (localtime)."
    /sbin/hwclock --localtime --systohc
  fi
fi

# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
  /etc/rc.d/rc.httpd stop
fi

# Stop the MySQL database:
if [ -r /var/run/mysql/mysql.pid ]; then
  . /etc/rc.d/rc.mysqld stop
fi

# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba stop
fi

# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
  /etc/rc.d/rc.nfsd stop
fi

# If it looks like we use an initrd, prepare for one at next boot:
if grep -q -w initrd /var/log/messages ; then
  mkdir -p /initrd
fi

# Unmount any NFS or SMB filesystems:
echo "Unmounting remote filesystems."
umount -a -r -t nfs,smbfs

# Try to kill dhcpcd so the DHCP leases can be returned:
killall -15 dhcpcd 1> /dev/null 2> /dev/null

# Try to shut down pppd:
PS="$(ps ax)"
if echo "$PS" | grep -q -w pppd ; then
  if [ -x /usr/sbin/ppp-off ]; then
    /usr/sbin/ppp-off
  fi
fi

# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ] ; then
  . /etc/rc.d/rc.pcmcia stop
  # The cards might need a little extra time here to initialize.
  sleep 5
fi

# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  echo "Turning off process accounting."
  /sbin/accton
fi

# Kill all processes.
# INIT is supposed to handle this entirely now, but this didn't always
# work correctly without this second pass at killing off the processes.
# Since INIT already notified the user that processes were being killed,
# we'll avoid echoing this info this time around.
if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
  killall5 -15
  sleep 5
  killall5 -9
fi

# Try to turn off quota.
if grep -q quota /etc/fstab ; then
  if [ -x /sbin/quotaoff ]; then
    echo "Turning off filesystem quotas."
    /sbin/quotaoff -a
  fi
fi

# Carry a random seed between reboots.
echo "Saving random seed from /dev/urandom in /etc/random-seed."
# Use the pool size from /proc, or 512 bytes:
if [ -r /proc/sys/kernel/random/poolsize ]; then
  dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
else
  dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
fi
chmod 600 /etc/random-seed

# Before unmounting file systems write a reboot or halt record to wtmp.
$command -w

# Clear /var/lock/subsys.
if [ -d /var/lock/subsys ]; then
  rm -f /var/lock/subsys/*
fi

# A function to deactivate LVM volume groups:
deactivate_lvm() {
  if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
    echo "Deactivating LVM volume groups:"
    if cat /proc/sys/kernel/osrelease | cut -f 1,2 -d . | grep -q -w 2.4 2> /dev/null ; then
      /sbin/vgchange -an
    else
      /sbin/vgchange -an --ignorelockingfailure
    fi
    sleep 10
  fi
}

# Turn off swap, then unmount local file systems.
echo "Turning off swap."
swapoff -a
sync

echo "Unmounting local file systems."
# Don't remount UMSDOS root volumes:
if [ ! "$(mount | head -n 1 | cut -d ' ' -f 5)" = "umsdos" ]; then
  umount -a -t nonfs,noproc,nosysfs
  deactivate_lvm
  umount -a -r -t nonfs,noproc,nosysfs
  echo "Remounting root filesystem read-only."
  mount -n -o remount,ro /
else
  umount -a -t nonfs,noproc,nosysfs,noumsdos,nosmbfs
  deactivate_lvm
  umount -a -r -t nonfs,noproc,nosysfs,noumsdos,nosmbfs
fi

# This never hurts:
sync

# sleep 1 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
sleep 1

# This is to ensure all processes have completed on SMP machines:
wait

if [ -x /sbin/genpowerd ]; then
  # See if this is a powerfail situation:
  if egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
    # Signal UPS to shut off the inverter:
    /sbin/genpowerd -k
    if [ ! $? = 0 ]; then
      echo
      echo "There was an error signaling the UPS."
      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
      echo "the serial line and UPS type."
      # Wasting 15 seconds of precious power:
      sleep 15
    fi
  fi
fi

# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$command" = "reboot" ]; then
  echo "Rebooting."
  reboot
else
  poweroff
fi
In the script it says if the command was "reboot" that it shouldn't powerdown, but it does... if it's not something wrong with the script then what else could I check?
 
Old 09-06-2004, 07:31 AM   #3
elsheikhmh
Member
 
Registered: Aug 2004
Location: Cairo, Egypt
Distribution: Slackware
Posts: 101

Rep: Reputation: 15
case "$0" in
*0)
command="halt"
;;
*6)
command=reboot
;;
*)

may be command="reboot" with quotes instead of reboot
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
reboot and shutdown problem doubleone Linux - Software 5 12-06-2004 10:51 PM
Problem with MDK10 to reboot or shutdown jies Linux - Newbie 0 06-02-2004 02:54 AM
Problem in REBOOT and SHUTDOWN satimis *BSD 3 02-27-2004 09:17 PM
debian shutdown halt problem acpi apm win32sux Linux - General 0 09-26-2003 12:57 PM
shutdown and reboot problem in RH 7.2 bpmovva Linux - Newbie 0 12-03-2001 06:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration