#!/bin/sh exit # # chkconfig: 2345 01 99 # description: Starts and stops each hotpluggable subsystem. # On startup, may simulate hotplug events for devices # that were present at boot time, before filesystems # used by /sbin/hotplug became available. # # $Id: hotplug.init,v 1.3 2002/01/17 12:39:01 ukai Exp $ # PATH=/sbin:/bin:/usr/sbin:/usr/bin test -x /sbin/hotplug || exit 0 case "$1" in start) echo -n "Starting hotplug subsystem:" if [ "$runlevel" = "S" ]; then touch /etc/nohotplug elif grep -q "^/sbin/hotplug$" /proc/sys/kernel/hotplug; then # but, pending hotplug action will be executed rm -f /etc/nohotplug echo ".... already started. process pending events." exit 0 fi echo /sbin/hotplug > /proc/sys/kernel/hotplug if [ "$runlevel" != "S" ]; then rm -f /etc/nohotplug # XXX: need wait? fi for RC in /etc/hotplug/*.rc do basename=${RC#/etc/hotplug/} name=${basename%.rc} echo -n " $name" $RC $1 done echo "." # touch /var/lock/subsys/hotplug ;; stop) echo -n "Stopping hotplug subsystem:" for RC in /etc/hotplug/*.rc do basename=${RC#/etc/hotplug/} name=${basename%.rc} echo -n " $name" $RC stop done echo /bin/true > /proc/sys/kernel/hotplug echo "." # rm -f /var/lock/subsys/hotplug ;; restart) echo -n "Restarting hotplug subsystem:" for RC in /etc/hotplug/*.rc do basename=${RC#/etc/hotplug/} name=${basename%.rc} echo -n " $name" $RC restart done echo "." ;; force-reload) $0 stop && $0 start ;; status) for RC in /etc/hotplug/*.rc do $RC $1 done ;; help|*) echo "Usage: $0 [help|start|stop|restart|status|force-reload]" exit 1 ;; esac exit 0