Skip to contentSkip to conversation

Little problem and questions about hotplug init script

PATCH Frank Murphy 1 participant 1 message Jul 9, 2003

lore
Share & tools
lore
#0 lore raw

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

hotplug.old renamed from hotplug +17 -12
@@ -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