summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2006-07-16 15:09:59 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 12:03:42 +0200
commit1ffd14d99010574eb42d354ddf18389a885b6a75 (patch)
tree92f725158eda75f0d6f4cd6a6e07029c60c8411f
parent[RELEASE] init-scripts-0.3.25 (diff)
downloadinit-scripts-1ffd14d99010574eb42d354ddf18389a885b6a75.tar.gz
[RELEASE] init-scripts-0.3.26v0.3.26
-rw-r--r--ChangeLog5
-rwxr-xr-xsbin/init.d/functions1
-rwxr-xr-xsbin/init.d/system92
3 files changed, 66 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 3645588..4909eab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003/11/11 : 0.3.26
+- functions : fixed stupid bug with uninitialized variable in list_options
+- system : added a help function
+- system : added 2 functions date_to_hw & date_from_hw to sync clocks
+- system : do_stop now uses recursive_rmmod
2003/10/26 : 0.3.25
- network : now supports a "vrrp" option which is only used by external scripts.
- squid : fix squidguard handling
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index 491ba41..bad32fc 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -583,6 +583,7 @@ function do_list_options {
eval eval echo $inst ${svc_opts[$i]} \$"${svc_vars[$i]}"
elif [ "${svc_fcts[$i]}" = "multiple_option" ]; then
eval nbocc='${#'"${svc_vars[$i]}"'[*]}'
+ occur=0
if [ $nbocc -eq 0 ]; then # no value, let's at least show the option name
eval echo $inst ${svc_opts[$i]}
else
diff --git a/sbin/init.d/system b/sbin/init.d/system
index 75d1884..02cf429 100755
--- a/sbin/init.d/system
+++ b/sbin/init.d/system
@@ -9,11 +9,67 @@ option file_max standard_option
option rtc standard_option "local" # "local", "utc", "disabled"
option rtc_mode standard_option "direct" # "direct", "kernel"
+
+function do_help {
+ echo "Usage: ${0##*/} <status|start|stop|date_to_hw|date_from_hw|help>"
+ echo "List of config.rc options (name, type, default value, current value) :"
+ echo
+ echo " - hostname : string ; ; cur=$opt_hostname"
+ echo " - modprobe : mod arg ; eg: usb-ohci ; cur='${opt_modprobe[@]}'"
+ echo " - sysctl : var=val ; eg: kernel.sysrq=0 ; cur='${opt_sysctl[@]}'"
+ echo " - filemax : integer ; ; cur=$opt_filemax"
+ echo " - rtc : local|utc|disabled ; local ; cur=$opt_rtc"
+ echo " - rtc_mode : direct|kernel ; direct ; cur=$opt_rtc_mode"
+ echo
+ exit 1
+}
+
+# gets system date from hardware clock
+function do_date_from_hw {
+ local rtc_opt=""
+
+ # this is necessary because some PCs (eg: siemens) hang otherwise.
+ if [ "$opt_rtc_mode" = "direct" ]; then
+ rtc_opt="$rtc_opt --directisa"
+ fi
+
+ if [ "$opt_rtc" = "utc" ]; then
+ echo -n "Setting system time from hardware clock (UTC)... "
+ hwclock --hctosys --noadjfile --utc $rtc_opt
+ echo "Done."
+ elif [ "$opt_rtc" = "local" ]; then
+ echo -n "Setting system time from hardware clock (Local time)... "
+ hwclock --hctosys --noadjfile --localtime $rtc_opt
+ echo "Done."
+ fi
+ return 0
+}
+
+# saves current date to hardware clock
+function do_date_to_hw {
+ local rtc_opt=""
+
+ # this is necessary because some PCs (eg: siemens) hang otherwise.
+ if [ "$opt_rtc_mode" = "direct" ]; then
+ rtc_opt="$rtc_opt --directisa"
+ fi
+
+ if [ "$opt_rtc" = "utc" ]; then
+ echo -n "Saving system time to hardware clock (UTC)... "
+ hwclock --systohc --noadjfile --utc $rtc_opt
+ echo "Done."
+ elif [ "$opt_rtc" = "local" ]; then
+ echo -n "Saving system time to hardware clock (Local time)... "
+ hwclock --systohc --noadjfile --localtime $rtc_opt
+ echo "Done."
+ fi
+ return 0
+}
+
function do_start {
local svcname=$1
local instname=$2
local arg
- local rtc_opt=""
arg=0
while [ $arg -lt ${#opt_modprobe[*]} ]; do
@@ -31,20 +87,7 @@ function do_start {
echo ${opt_hostname#*.} >/proc/sys/kernel/domainname
fi
- # this is necessary because some PCs (eg: siemens) hang otherwise.
- if [ "$opt_rtc_mode" = "direct" ]; then
- rtc_opt="$rtc_opt --directisa"
- fi
-
- if [ "$opt_rtc" = "utc" ]; then
- echo -n "Setting system time from hardware clock (UTC)... "
- hwclock --hctosys --noadjfile --utc $rtc_opt
- echo "Done."
- elif [ "$opt_rtc" = "local" ]; then
- echo -n "Setting system time from hardware clock (Local time)... "
- hwclock --hctosys --noadjfile --localtime $rtc_opt
- echo "Done."
- fi
+ do_date_from_hw
for arg in ${opt_sysctl[*]}; do
local sysctl value
@@ -68,7 +111,6 @@ function do_status {
return 0
}
-
function do_stop {
local svcname=$1
local instname=$2
@@ -77,24 +119,10 @@ function do_stop {
arg=${#opt_modprobe[*]}
while [ $arg -gt 0 ]; do
arg=$[$arg-1]
- rmmod -r ${opt_modprobe[$arg]} >/dev/null 2>&1
+ recursive_rmmod ${opt_modprobe[$arg]} >/dev/null 2>&1
done
- # this is necessary because some PCs (eg: siemens) hang otherwise.
- if [ "$opt_rtc_mode" = "direct" ]; then
- rtc_opt="$rtc_opt --directisa"
- fi
-
- if [ "$opt_rtc" = "utc" ]; then
- echo -n "Saving system time to hardware clock (UTC)... "
- hwclock --systohc --noadjfile --utc $rtc_opt
- echo "Done."
- elif [ "$opt_rtc" = "local" ]; then
- echo -n "Saving system time to hardware clock (Local time)... "
- hwclock --systohc --noadjfile --localtime $rtc_opt
- echo "Done."
- fi
-
+ do_date_to_hw
return 0
}