From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Murphy Date: Wed, 09 Jul 2003 11:32:36 +0000 Subject: Little problem and questions about hotplug init script MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_U1/C/WEy8UP/Sef" Message-Id: List-Id: To: linux-hotplug@vger.kernel.org --Boundary-00=_U1/C/WEy8UP/Sef Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline I've been looking at some of the hotplug stuff, and I found a typo and another problem in the init.d/rc.d script. It also prompts some questions for me. I've attached a diff as well as the whole script with the changes, My first question is about the /var/lock/subsys/hotplug lock file. What is it supposed to be locking? Because for the force-reload case, it doesn't work properly (a lockfile exists during startup, but not afterwards -- the exact opposite of what would happen if the script were called first with stop, then start). My second question is about the /etc/init.d/functions. I assume that each distribution has a different method for these init scripts, so the version that ships with hotplug is more of a reference implementation that will be modified. Seeing as this version doesn't use any included functions, and hotplug doesn't ship with this functions file, perhaps this should be deleted? My third question is about the description at the top. Why are the comment lines followed by a backslash (\) ? Is there some tool being used to parse these? Thanks for any help. Frank --Boundary-00=_U1/C/WEy8UP/Sef Content-Type: application/x-shellscript; name="hotplug" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hotplug" #!/bin/sh # # hotplug This scripts starts hotpluggable subsystems. # # 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 \ # (or other resources) used by hotplug agents were available. # # $Id: hotplug,v 1.3 2002/12/03 02:01:48 dbrownell Exp $ # PATH=/sbin:/bin:/usr/sbin:/usr/bin # source function library if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions fi run_rc_files () { for RC in /etc/hotplug/*.rc do $RC $1 done } case "$1" in start|restart|status) run_rc_files $1 touch /var/lock/subsys/hotplug ;; stop) run_rc_files $1 rm -f /var/lock/subsys/hotplug ;; force-reload) run_rc_files stop run_rc_files start rm -f /var/lock/subsys/hotplug ;; *) echo $"Usage: $0 {start|stop|restart|status|force-reload}" exit 3 ;; esac --Boundary-00=_U1/C/WEy8UP/Sef Content-Type: text/x-diff; charset="us-ascii"; name="hotplug.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hotplug.patch" --- hotplug 2003-07-09 13:24:09.000000000 +0200 +++ hotplug.old 2003-07-09 13:24:58.000000000 +0200 @@ -20,30 +20,35 @@ . /etc/rc.d/init.d/functions fi -run_rc_files () { - for RC in /etc/hotplug/*.rc - do - $RC $1 - done -} - case "$1" in start|restart|status) - run_rc_files $1 + for RC in /etc/hotplug/*.rc + do + $RC $1 + done touch /var/lock/subsys/hotplug ;; stop) - run_rc_files $1 + for RC in /etc/hotplug/*.rc + do + $RC stop + done rm -f /var/lock/subsys/hotplug ;; force-reload) - run_rc_files stop - run_rc_files start + for RC in /etc/hotplug/*.rc + do + $RC stop + done + for RC in /etc/hotplug/*.rc + do + $RC start + done rm -f /var/lock/subsys/hotplug ;; *) - echo $"Usage: $0 {start|stop|restart|status|force-reload}" + echo $"Usage: $0 {start|stop|restart|status|force_reload}" exit 3 ;; esac --Boundary-00=_U1/C/WEy8UP/Sef-- ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel