packages: rc-scripts-user/userscripts.init - only process *.init and *.sh f...

sparky sparky at pld-linux.org
Wed Feb 2 20:23:46 CET 2011


Author: sparky                       Date: Wed Feb  2 19:23:46 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- only process *.init and *.sh files, everything else is ignored
- pass restart and reload directly to user scripts, instead of stop+start

---- Files affected:
packages/rc-scripts-user:
   userscripts.init (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: packages/rc-scripts-user/userscripts.init
diff -u packages/rc-scripts-user/userscripts.init:1.7 packages/rc-scripts-user/userscripts.init:1.8
--- packages/rc-scripts-user/userscripts.init:1.7	Tue Feb  1 10:32:28 2011
+++ packages/rc-scripts-user/userscripts.init	Wed Feb  2 20:23:41 2011
@@ -81,9 +81,11 @@
 		local USER_SCRIPTS=0
 		for script in "$home/$scripts_dir"/*; do
 
-			# skip backups
+			# skip unrecognized files
 			case $script in
-				*~|*.bak)
+				*.init|*.sh)
+					;;
+				*)
 					continue
 					;;
 			esac
@@ -146,6 +148,29 @@
 	rm -f /var/lock/subsys/userscripts
 }
 
+restart()
+{
+	if [ ! -f /var/lock/subsys/userscripts ]; then
+		msg_not_running "$service_name"
+		start
+		return $?
+	fi
+
+	show "Restarting %s service" "$service_name"; ok
+	run_scripts restart
+}
+
+reload()
+{
+	if [ ! -f /var/lock/subsys/userscripts ]; then
+		msg_not_running "$service_name"
+		return 2
+	fi
+
+	msg_reloading "$service_name"; ok
+	run_scripts reload
+}
+
 status()
 {
 	if [ -f /var/lock/subsys/userscripts ]; then
@@ -167,13 +192,14 @@
   	status)
 		status
 		;;
-	restart|force-reload)
-		stop
-		start
-		exit $?
+	restart)
+		restart
+		;;
+	reload|force-reload)
+		reload
 		;;
 	*)
-		msg_usage "$0 {start|stop|restart|force-reload|status}"
+		msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
 		exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rc-scripts-user/userscripts.init?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list