Harmonise les bootscripts (daemon)
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Sun, 8 May 2011 21:14:08 +0000 (21:14 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Sun, 8 May 2011 21:14:08 +0000 (21:14 +0000)
17 files changed:
stage1/bootscripts/udev
stage1/install-bootscripts
stage2/bootscripts/acpid
stage2/bootscripts/dhcp
stage2/bootscripts/klogd [new file with mode: 0755]
stage2/bootscripts/sysklogd [deleted file]
stage2/bootscripts/syslogd [new file with mode: 0755]
stage2/install-bootscripts
stage3/bootscripts/fcron
stage3/bootscripts/named
stage3/bootscripts/openldap
stage3/bootscripts/portmap
stage3/bootscripts/saslauthd
stage3/bootscripts/sshd
stage3/bootscripts/xinetd
stage4/bootscripts/dbus
stage4/bootscripts/hald

index 705b160..7c10b0d 100644 (file)
@@ -3,6 +3,10 @@
 # udev
 # Udev cold-plugging script
 
+DAEMON=/sbin/udevd
+DAEMON_DESC=UDEV
+DAEMON_OPTS="--daemon"
+
 # Source functions library
 source /etc/rc.d/init.d/functions
 
@@ -25,7 +29,7 @@ udev_start()
     echo "" > /sys/kernel/uevent_helper &&
 
     # Start the udev daemon to continually watch for, and act on uevents
-    /sbin/udevd --daemon
+    ${DAEMON} ${DAEMON_OPTS}
 }
 
 # See how we were called
@@ -40,16 +44,14 @@ case "$1" in
         # The reason we don't write to mtab is because we don't ever
         # want /dev to be unavailable (such as by `umount -a').
        cmd_run_log_box "Mounting /dev in tmpfs" mount -n -t tmpfs -o mode=0755 udev /dev
-
        cmd_run_log_box "Copying static /dev entries" cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev
-
        cmd_run_log_box "Setting permissons on /dev/shm" chmod 1777 /dev/shm
 
-       cmd_run_log_box_warn "Starting udevd" udev_start
+       cmd_run_log_box_warn "${DAEMON_DESC} start" udev_start
 
        cmd_run_log_box "Performing Coldplugging" udev_coldplug
        ;;
-    
+
     *)
        echo "Usage: $0 {start}"
        exit ${EXIT_CODE_FAILURE}
index db4723f..284b272 100755 (executable)
@@ -37,7 +37,7 @@ bootscript_add_rcsysinit checkfs     30 00
 bootscript_add_rcsysinit mountfs     35 95
 bootscript_add_rcsysinit swap        40 94
 bootscript_add_rcsysinit cleanfs     45 00
-bootscript_add_rcsysinit setclock    60 92
+bootscript_add_rcsysinit setclock    60 91
 
 # rc0.d
 bootscript_add_manual 0 sendsignals 95 00
index 362d2fe..c133267 100755 (executable)
@@ -5,19 +5,19 @@
 # Source functions library
 source /etc/rc.d/init.d/functions
 
-DAEMON=acpid
-DAEMON_DESC="ACPI"
-DAEMON_OPTS="--netlink --logevents"
-
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/acpid
+DAEMON_DESC="ACPI daemon"
+DAEMON_OPTS="--netlink --logevents"
+
 case "$1" in
     start)
-       cmd_run_log_box_warn "${DAEMON_DESC} daemon start" loadproc /usr/sbin/${DAEMON} ${DAEMON_OPTS}
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
        ;;
 
     stop)
-       cmd_run_log_box_warn "${DAEMON_DESC} daemon stop" killproc ${DAEMON}
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
         ;;
 
     status)
index fbbd241..b814bb2 100755 (executable)
@@ -10,6 +10,10 @@ log_script_name "$0 $*"
 # Load global network parameters
 source /etc/sysconfig/network/network-parameters
 
+DAEMON=/usr/sbin/dhcpd
+DAEMON_DESC="DHCP server"
+DAEMON_OPTS="-q ${DHCP_SERVER_IF}"
+
 if [ -z "${DHCP_SERVER_IF}" ]; then
     # DHCP server is not enabled
     msg_log "DHCP server disabled in '/etc/sysconfig/network/network-parameters'"
@@ -24,13 +28,13 @@ fi
 # See how we were called
 case "$1" in
     start)
-       cmd_run_log_box_warn "DHCP server start" loadproc /usr/sbin/dhcpd -q ${DHCP_SERVER_IF}
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
        ;;
-    
+
     stop)
-       cmd_run_log_box_warn "DHCP server stop" killproc /usr/sbin/dhcpd
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
        ;;
-   
+
     restart)
        $0 stop
        sleep 1
@@ -38,9 +42,9 @@ case "$1" in
        ;;
 
     status)
-       statusproc /usr/sbin/dhcpd
+       statusproc ${DAEMON}
        ;;
-    
+
     *)
        echo "Usage: $0 {restart|start|status|stop}"
         exit ${EXIT_CODE_FAILURE}
diff --git a/stage2/bootscripts/klogd b/stage2/bootscripts/klogd
new file mode 100755 (executable)
index 0000000..959a90e
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# klogd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+DAEMON=/sbin/klogd
+DAEMON_DESC="Kernel log daemon"
+DAEMON_OPTS="-k /boot/System-$(uname -r).map"
+
+case "$1" in
+    start)
+        cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
+       ;;
+
+    stop)
+        cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
+       ;;
+
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc klogd
+       ;;
+
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/sysklogd b/stage2/bootscripts/sysklogd
deleted file mode 100755 (executable)
index f531bdd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-# syslogd
-
-# Source functions library
-source /etc/rc.d/init.d/functions
-
-log_script_name "$0 $*"
-
-SYSLOGD_OPTS="-r"
-KLOGD_OPTS="-k /boot/System-$(uname -r).map"
-
-case "$1" in
-    start)
-       cmd_run_log_box_warn "Starting system log daemon" loadproc syslogd ${SYSLOGD_OPTS}
-        cmd_run_log_box_warn "Starting kernel log daemon" loadproc klogd ${KLOGD_OPTS}
-       ;;
-    
-    stop)
-       cmd_run_log_box_warn "Stopping kernel log daemon" killproc klogd
-       cmd_run_log_box_warn "Stopping system log daemon" killproc syslogd
-       ;;
-    
-    reload)
-       cmd_run_nolog_box "Reloading system log daemon configuration file" reloadproc syslogd 1
-       ;;
-    
-    restart)
-       $0 stop
-       sleep 1
-       $0 start
-       ;;
-    
-    status)
-       statusproc syslogd
-       statusproc klogd
-       ;;
-    
-    *)
-       echo "Usage: $0 {start|stop|reload|restart|status}"
-        exit ${EXIT_CODE_FAILURE}
-       ;;
-    
-esac
-
-exit $?
diff --git a/stage2/bootscripts/syslogd b/stage2/bootscripts/syslogd
new file mode 100755 (executable)
index 0000000..a908c5a
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# syslogd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+DAEMON=/sbin/syslogd
+DAEMON_DESC="System log daemon"
+DAEMON_OPTS="-r"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
+       ;;
+
+    stop)
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
+       ;;
+
+    reload)
+       cmd_run_nolog_box "${DAEMON_DESC} reload configuration file" reloadproc ${DAEMON} 1
+       ;;
+
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc ${DAEMON}
+       ;;
+
+    *)
+       echo "Usage: $0 {start|stop|reload|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
index 8785e7e..2e1d394 100755 (executable)
@@ -88,7 +88,7 @@ fi
 sed -i -e "s!^\(export PATH=\).*tools.*!\1/bin:/usr/bin:/sbin:/usr/sbin!" /etc/rc.d/init.d/functions
 
 # Copying boot scripts
-STAGE2_BOOTSCRIPTS="ifdown ifup keyboard mountnetfs network sysklogd"
+STAGE2_BOOTSCRIPTS="ifdown ifup keyboard mountnetfs network syslogd klogd"
 for bootscript in ${STAGE2_BOOTSCRIPTS}; do
     install -m755 bootscripts/${bootscript} /etc/rc.d/init.d
 done
@@ -99,6 +99,7 @@ export LFS=
 
 # rcsysinit.d
 bootscript_add_rcsysinit sysklogd  50 93
+bootscript_add_rcsysinit klogd     51 92
 bootscript_add_rcsysinit keyboard  55 00
 
 # rc3.d
index 9fd60a8..a34a0f7 100755 (executable)
@@ -7,36 +7,40 @@ source /etc/rc.d/init.d/functions
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/fcron
+DAEMON_DESC="fcron daemon"
+DAEMON_OPTS="-b -c /etc/fcron/fcron.conf"
+
 fcron_start()
 {
     /etc/fcron/configure
-    loadproc fcron -b -c /etc/fcron/fcron.conf
+    loadproc ${DAEMON} ${DAEMON_OPTS}
 }
 
 # See how we were called.
 case "$1" in
     start)
-        cmd_run_log_box_warn "Starting fcron" fcron_start
+        cmd_run_log_box_warn "${DAEMON_DESC} start" fcron_start
         ;;
-    
+
     stop)
-       cmd_run_log_box_warn "Stopping fcron" killproc fcron
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
         ;;
-    
+
     reload)
-       cmd_run_log_box_warn "reloading fcron" reloadproc fcron
+       cmd_run_log_box_warn "${DAEMON_DESC} reload" reloadproc ${DAEMON}
         ;;
-    
+
     restart)
         $0 stop
         sleep 1
         $0 start
         ;;
-    
+
     status)
-        statusproc fcron
+        statusproc ${DAEMON}
         ;;
-    
+
     *)
         echo "Usage: $0 {start|stop|reload|restart|status}"
         exit ${EXIT_CODE_FAILURE}
index 80c9dc6..108a452 100755 (executable)
@@ -8,6 +8,10 @@ source /etc/sysconfig/network/network-parameters
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/named
+DAEMON_DESC="BIND server"
+DAEMON_OPTS="-u named -t /home/named -c /etc/named.conf"
+
 init_resolver()
 {
     echo "search ${DOMAINNAME}" > /etc/resolv.conf &&
@@ -16,14 +20,14 @@ init_resolver()
 
 case $1 in
     start)
-       cmd_run_log_box_warn "Starting named" loadproc /usr/sbin/named -u named -t /home/named -c /etc/named.conf &&
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS} &&
         init_resolver
         ;;
-    
+
     stop)
-       cmd_run_log_box_warn "Stopping named" killproc named
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
         ;;
-    
+
     restart)
         $0 stop
         sleep 1
@@ -31,13 +35,13 @@ case $1 in
         ;;
 
     reload)
-       cmd_run_log_box "Reloading named" /usr/sbin/rndc -c /etc/rndc.conf reload
+       cmd_run_log_box "${DAEMON_DESC} reload" /usr/sbin/rndc -c /etc/rndc.conf reload
         ;;
-    
+
     status)
-        statusproc named
+        statusproc ${DAEMON}
         ;;
-    
+
     *)
         echo "Usage: $0 {start|stop|restart|status}"
         exit ${EXIT_CODE_FAILURE}
index 2896184..1487bb0 100755 (executable)
@@ -7,17 +7,21 @@ source /etc/rc.d/init.d/functions
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/slapd
+DAEMON_DESC="LDAP server"
+DAEMON_OPTS=""
+
 piddir=/srv/ldap/run
 
 case "$1" in
     start)
-       cmd_run_log_box_warn "Starting LDAP Server" loadproc slapd
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON}
         ;;
-    
+
     stop)
-       cmd_run_log_box_warn "Stopping LDAP Server" killproc_path slapd ${piddir}
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc_path ${DAEMON} ${piddir}
         ;;
-                
+
     restart)
         $0 stop
         sleep 1
@@ -25,9 +29,9 @@ case "$1" in
         ;;
 
     status)
-       statusproc_path slapd ${piddir}
+       statusproc_path ${DAEMON} ${piddir}
         ;;
-    
+
     *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit ${EXIT_CODE_FAILURE}
index f386704..86796d5 100755 (executable)
@@ -11,6 +11,10 @@ log_script_name "$0 $*"
 # Load global network parameters
 source /etc/sysconfig/network/network-parameters
 
+DAEMON=/sbin/portmap
+DAEMON_DESC="RPC port mapper"
+DAEMON_OPTS=""
+
 # Check if NFS server must be enabled
 #if [ "x${NFS_SERVER_ENA}" != "xyes" -a "x${NFS_SERVER_ENA}" != "xYes" 
 #-a "x${NFS_SERVER_ENA}" != "xYES" ]; then
@@ -20,15 +24,15 @@ source /etc/sysconfig/network/network-parameters
 # See how we were called
 case "$1" in
     start)
-       cmd_run_log_box_warn "portmap start" loadproc portmap
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
        ;;
 
     stop)
-       cmd_run_log_box_warn "portmap stop" killproc portmap
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
        ;;
 
     reload)
-       reloadproc portmap
+       reloadproc ${DAEMON}
        ;;
 
     restart)
@@ -38,7 +42,7 @@ case "$1" in
        ;;
 
     status)
-       statusproc portmap
+       statusproc ${DAEMON}
        ;;
 
     *)
index 6d271a5..3fdba43 100755 (executable)
@@ -7,19 +7,23 @@ source /etc/rc.d/init.d/functions
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/saslauthd
+DAEMON_DESC="SASL authentication daemon"
+DAEMON_OPTS="-a shadow"
+
 case "$1" in
     start)
-       cmd_run_log_box_warn "SASL daemon start" loadproc /usr/sbin/saslauthd -a shadow
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
         ;;
 
     stop)
-       cmd_run_log_box_warn "SASL daemon stop" killproc saslauthd
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
         ;;
-                
+
     status)
-        statusproc saslauthd
+        statusproc ${DAEMON}
         ;;
-        
+
     restart)
         $0 stop
         sleep 1
index 026f04d..1d3ab9f 100755 (executable)
@@ -9,7 +9,9 @@ source /etc/sysconfig/network/network-parameters
 
 log_script_name "$0 $*"
 
-SSHD="/usr/sbin/sshd -4"
+DAEMON="/usr/sbin/sshd"
+DAEMON_DESC="SSH server"
+DAEMON_OPTS="-4"
 
 # Check if SSH server is desired
 if [ "x${SSH_SERVER_ENA}" != "xyes" -a "x${SSH_SERVER_ENA}" != "xYes" -a "x${SSH_SERVER_ENA}" != "xYES" ]; then
@@ -44,22 +46,22 @@ sshd_start() {
     if [ $? -ne 0 ]; then
        exit ${EXIT_CODE_FAILURE}
     else
-       loadproc ${SSHD}
+       loadproc ${DAEMON} ${DAEMON_OPTS}
     fi
 }
 
 # See how we were called
 case "$1" in
     start)
-       cmd_run_log_box_warn "Starting sshd" sshd_start
+       cmd_run_log_box_warn "${DAEMON_DESC} start" sshd_start
        ;;
 
     stop)
-       cmd_run_log_box_warn "Stopping sshd" killproc sshd
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
        ;;
 
     reload)
-       reloadproc sshd
+       reloadproc ${DAEMON}
        ;;
 
     restart)
@@ -69,7 +71,7 @@ case "$1" in
        ;;
 
     status)
-       statusproc sshd
+       statusproc ${DAEMON}
        ;;
 
     *)
index 75e1221..566fcec 100755 (executable)
@@ -3,32 +3,33 @@
 # Source functions library
 source /etc/rc.d/init.d/functions
 
-DAEMON=xinetd
+DAEMON=/usr/sbin/xinetd
+DAEMON_DESC="xinetd daemon"
+DAEMON_OPTS=""
 
 case "$1" in
     start)
-       cmd_run_log_box_warn "Starting xinetd daemon" loadproc ${DAEMON}
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_OPTS}
        ;;
-    
+
     stop)
-       cmd_run_log_box_warn "Stopping xinetd daemon" killproc ${DAEMON}
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
        ;;
-    
+
     restart)
        $0 stop
        sleep 1
        $0 start
        ;;
-    
+
     status)
        statusproc ${DAEMON}
        ;;
-    
+
     *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit ${EXIT_CODE_FAILURE}
        ;;
-    
 esac
 
 exit $?
index fe6987f..0efaa69 100755 (executable)
@@ -7,8 +7,12 @@ source /etc/rc.d/init.d/functions
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/bin/dbus-daemon
+DAEMON_DESC="D-BUS Messagebus daemon"
+DAEMON_OPTS="--config-file=/etc/dbus-1/system.conf"
+
 dbus_start() {
-    if statusproc dbus-daemon | grep -q "not running"; then
+    if statusproc ${DAEMON} | grep -q "not running"; then
        if [ -f /var/run/dbus/pid ]; then
            rm /var/run/dbus/pid
        fi
@@ -19,8 +23,8 @@ dbus_start() {
        echo "Already running..."
        return ${EXIT_CODE_WARNING}
     fi
-    
-    loadproc /usr/bin/dbus-daemon --config-file=/etc/dbus-1/system.conf
+
+    loadproc ${DAEMON} ${DAEMON_OPTS}
 
     return $?
 }
@@ -28,19 +32,19 @@ dbus_start() {
 
 case "$1" in
     start)
-       cmd_run_log_box_warn "D-Bus Messagebus Daemon start" dbus_start
+       cmd_run_log_box_warn "${DAEMON_DESC} start" dbus_start
         ;;
 
     stop)
-       cmd_run_log_box_warn "D-Bus Messagebus Daemon stop" killproc dbus-daemon &&
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON} &&
        rm /var/run/dbus/pid &&
        rm /var/run/dbus/system_bus_socket
         ;;
-                
+
     status)
-        statusproc dbus-daemon
+        statusproc ${DAEMON}
         ;;
-        
+
     restart)
         $0 stop
         sleep 1
index 623f5fb..5249d8c 100755 (executable)
@@ -7,25 +7,29 @@ source /etc/rc.d/init.d/functions
 
 log_script_name "$0 $*"
 
+DAEMON=/usr/sbin/hald
+DAEMON_DESC="HAL daemon"
+DAEMON_OPTS="--use-syslog"
+
 case "$1" in
     start)
-       cmd_run_log_box_warn "HAL Daemon start" loadproc /usr/sbin/hald --use-syslog
+       cmd_run_log_box_warn "${DAEMON_DESC} start" loadproc ${DAEMON} ${DAEMON_DESC}
        ;;
-    
+
     stop)
-       cmd_run_log_box_warn "HAL Daemon stop" killproc /usr/sbin/hald
+       cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON}
         ;;
-    
+
     status)
-        statusproc hald
+        statusproc ${DAEMON}
         ;;
-    
+
     restart)
         $0 stop
         sleep 1
         $0 start
         ;;
-    
+
     *)
        echo "Usage: $0 {restart|start|status|stop}"
        exit ${EXIT_CODE_FAILURE}