initscripts global change

Elan Ruusamäe glen at pld-linux.org
Wed Oct 15 13:15:57 CEST 2008


what you think of this change?
it will make global $PROG (varname could be debated), 
which means always same service name regardless of invocation:

/sbin/service httpd
/etc/rc.d/init.d/httpd
/etc/rc.d/rc2.d/K15httpd

and propagates more /sbin/service usage
(which is preffered as it cleans up $ENV for invoked daemons)

builder-ac share/mysql # d /etc/rc.d/rc2.d/*httpd
--- /etc/rc.d/rc2.d/K15httpd~    2008-10-15 14:13:18.000000000 +0300
+++ /etc/rc.d/rc2.d/K15httpd    2008-10-15 14:13:22.567094610 +0300
@@ -18,6 +18,8 @@
 # Get service config
 [ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd

+PROG=${0##*/}; PROG=${PROG#[SK][0-9][0-9]}
+
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
     if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
@@ -126,7 +128,7 @@
     fi
     ;;
   *)
-    msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|graceful|status}"
+    msg_usage "/sbin/service $PROG {start|stop|restart|try-restart|reload|force-reload|graceful|status}"
     exit 3
     ;;
 esac
(END)

-- 
glen


More information about the pld-devel-en mailing list