summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Jaspert <joerg@debian.org>2008-09-28 11:50:54 +0200
committerJoerg Jaspert <joerg@debian.org>2008-09-28 11:50:54 +0200
commit19f5c09c814fc68a2f5cadcf116839ecbf5a80cf (patch)
tree971da721b68b985c45b5fe49cbd36d6f13214df2
parent75d690ad884eda791eac64d41c878b37bbd12e5c (diff)
Fixes
- Use $LOGDIR where we want the dir and not the file - use $LOG where we want the file. - use proper "" around variables where they have to be Signed-off-by: Joerg Jaspert <joerg@debian.org>
-rwxr-xr-xbin/runmirrors15
-rw-r--r--etc/common3
2 files changed, 10 insertions, 8 deletions
diff --git a/bin/runmirrors b/bin/runmirrors
index 5c311de..3c397c6 100755
--- a/bin/runmirrors
+++ b/bin/runmirrors
@@ -23,7 +23,7 @@ set -e
NAME="`basename $0`"
# In case we are called with an argument we look for a different configuration.
-if [ -n $1 ];
+if [ -n "$1" ]; then
NAME="${NAME}-$1"
fi
@@ -50,20 +50,20 @@ MIRRORS=${MIRRORS:-"${HOME}/etc/${NAME}.mirror"}
PROGRAM=${PROGRAM:-"${NAME}-$(hostname -s)"}
# Make sure we have our log directory
-mkdir -p ${LOG}
+mkdir -p ${LOGDIR}
# Some sane defaults
cd ${HOME}
umask 002
-trap 'log "Mirrorpush done"; ${SAVELOG} "${LOG}/runmirrors" > /dev/null' EXIT
+trap 'log "Mirrorpush done"; ${SAVELOG} "${LOG}" > /dev/null' EXIT
# Start log by redirecting everything there.
-exec >"${LOG}/runmirrors" 2>&1
+exec >"${LOG}" 2>&1
log "Pushing leaf mirrors"
-if [ -n ${HOOK1} ]; then
+if [ -n "${HOOK1}" ]; then
log "Running hook1: ${HOOK1}"
${HOOK1}
result=$?
@@ -80,6 +80,7 @@ egrep -v '^[[:space:]]*(#|$)' ${MIRRORS} |
while read MLNAME MHOSTNAME MUSER MPROTO MKEYFILE; do
if [ "x${MLNAME}x" = "xDELAYx" ]; then
# We should wait a bit.
+ log "Delay of ${DELAY} seconds requested, sleeping"
sleep ${DELAY}
continue
fi
@@ -102,7 +103,7 @@ while read MLNAME MHOSTNAME MUSER MPROTO MKEYFILE; do
log "Trigger ${MLNAME}"
signal ${MLNAME} ${MHOSTNAME} ${MUSER} ${MPROTO} ${MKEYFILE}
log "Trigger for ${MLNAME} done"
- if [ -n ${HOOK2} ]; then
+ if [ -n "${HOOK2}" ]; then
log "Running hook2: ${HOOK2}"
${HOOK1}
result=$?
@@ -110,7 +111,7 @@ while read MLNAME MHOSTNAME MUSER MPROTO MKEYFILE; do
fi
done
-if [ -n ${HOOK3} ]; then
+if [ -n "${HOOK3}" ]; then
log "Running hook3: ${HOOK3}"
${HOOK3}
result=$?
diff --git a/etc/common b/etc/common
index 699481b..49b9b75 100644
--- a/etc/common
+++ b/etc/common
@@ -27,7 +27,8 @@ signal () {
fi
# Finally call ssh
- ssh $SSH_OPTIONS -i "$5" -o"user $3" -$4 "$2" sleep 1 >> ${LOG}/$1.log 2>&1 &
+ date -u >> ${LOGDIR}/$1.log
+ ssh $SSH_OPTIONS -i "$5" -o"user $3" -$4 "$2" sleep 1 >> ${LOGDIR}/$1.log 2>&1 &
}