summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rwxr-xr-xsbin/init.d/functions12
-rwxr-xr-xsbin/init.d/ntp5
3 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ec0dc00..499e7f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003/06/12
+- correction de la lecture du pid dans functions
+- valueof ne fait le grep que si le fichier existe
+- correctifs sur le script ntp
2003/06/05
- petits correctifs et quelques mises à jour
- plusieurs scripts comprennent dorénavant l'option nice
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index 2d5954f..0ce55ac 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -98,7 +98,11 @@ function logit {
# usage: valueof CONFIGFILE PARAMETER
function valueof {
- REPLY=$(grep $'^[ \t]*'"$2"'[:= \t]*' $1|sed s,'^\('$'[ \t]*'"$2"$'[ \t:=]*''\)\([^#]*\).*$,\2,')
+ if [ -e "$1" ]; then
+ REPLY=$(grep $'^[ \t]*'"$2"'[:= \t]*' $1|sed s,'^\('$'[ \t]*'"$2"$'[ \t:=]*''\)\([^#]*\).*$,\2,')
+ else
+ REPLY=
+ fi
echo $REPLY
}
@@ -162,7 +166,7 @@ function remount_rw {
return 1
fi
echo -n " - remounting $root read-write ..."
- if mount -wo remount $root >/dev/null 2>&1; then
+ if remountw $root >/dev/null 2>&1; then
echo " => done."
return 0
else
@@ -187,7 +191,7 @@ function remount_ro {
return 1
fi
echo -n " - remounting $root read-only ..."
- if mount -ro remount $root >/dev/null 2>&1; then
+ if remountr $root >/dev/null 2>&1; then
echo " => done."
return 0
else
@@ -391,7 +395,7 @@ function do_stop_with_pidfile {
svc_pidof -o $$ $pname > /dev/null ; pids=$REPLY
if [ $FORCE_START_STOP -eq 0 ]; then
- if ! [ -r "$pidfile" ] || ! read pid REPLY <"$pidfile" || ! [ -L /proc/$pid/cwd ]; then
+ if ! [ -r "$pidfile" ] || { read pid REPLY <"$pidfile"; [ -z "$pid" ]; } || ! [ -L /proc/$pid/cwd ]; then
echo "# Process $pname${instname:+[$instname]} already stopped (according to $pidfile)${pids:+, but check pids : $pids}"
# ensure that we remove stale files
[ -e "$pidfile" ] && echo "Removing stale pid file" && rm -f "$pidfile"
diff --git a/sbin/init.d/ntp b/sbin/init.d/ntp
index c654485..3d18789 100755
--- a/sbin/init.d/ntp
+++ b/sbin/init.d/ntp
@@ -26,8 +26,8 @@ function fct_pre_start {
local driftfile
valueof $opt_config driftfile > /dev/null 2>&1 ; driftfile=$REPLY
- if [ ! -e $( dirname $driftfile ) ] ; then
- mkdir -p $(dirname $driftfile)
+ if [ -n "$driftfile" -a ! -e "${driftfile%/*}" ] ; then
+ mkdir -p ${driftfile%/*}
fi
if [ "$opt_force_sync" = "1" -a "$opt_sync_servers" ]; then
ntpdate -u -t 2 $opt_sync_servers
@@ -53,3 +53,4 @@ function do_update {
}
load_config
+