crux-initscripts

hacked CRUX initscripts to work with sinit
git clone git://git.2f30.org/crux-initscripts
Log | Files | Refs | README

rc.shutdown (1081B)


      1 #!/bin/bash
      2 #
      3 # /etc/rc.shutdown: system shutdown script
      4 #
      5 
      6 # Load configuration
      7 . /etc/rc.conf
      8 
      9 # Set linefeed mode to avoid staircase effect
     10 /bin/stty onlcr
     11 
     12 echo "The system is coming down.  Please wait."
     13 
     14 # Shutdown services
     15 if [ "${SERVICES[*]}" ]; then
     16 	for service in "${SERVICES[@]}"; do
     17 		R_SERVICES=($service ${R_SERVICES[@]})
     18 	done
     19 	for service in "${R_SERVICES[@]}"; do
     20 		/etc/rc.d/$service stop &> /tmp/rc.$$
     21 		/usr/bin/logger -t $service -f /tmp/rc.$$
     22 		/bin/rm -f /tmp/rc.$$
     23 	done
     24 fi
     25 
     26 # Terminate all processes
     27 /sbin/killall5 -15
     28 /bin/sleep 5
     29 /sbin/killall5 -9
     30 
     31 # Save random seed
     32 /bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null
     33 
     34 # Save system clock
     35 /sbin/hwclock --systohc
     36 
     37 # Turn off swap
     38 /sbin/swapoff -a
     39 
     40 # Unmount file systems
     41 /bin/umount -a -d -r -t nosysfs,noproc,nodevtmpfs
     42 if [ -x /sbin/lvm ]; then
     43 	/sbin/vgchange --ignorelockingfailure -a n
     44 fi
     45 /bin/umount -a -r
     46 
     47 # Remount root filesystem read-only
     48 /bin/mount -o remount,ro /
     49 
     50 # Power off or reboot
     51 if [ "$1" = "poweroff" ]; then
     52 	/sbin/halt -p
     53 else
     54 	/sbin/halt -r
     55 fi
     56 
     57 # End of file