From 680a989f2ac476a1a651f950e71967ce5bc9fdbd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 29 Mar 2012 17:46:29 +0200 Subject: [PATCH] wget wird jetzt wieder korrekt beendet --- Dump.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dump.sh b/Dump.sh index 60f1b9b..ee36eff 100755 --- a/Dump.sh +++ b/Dump.sh @@ -6,7 +6,7 @@ PORT=8080 USERNAME=admin PASSWORD="123456" CAMERAS="0 1 2 3 4 5 6 7 8" -SECONDS_PER_FILE=5 +SECONDS_PER_FILE=60 PIDFILE_BASE=/tmp/wget_script.$RANDOM.pids if [ -z "$NAME" ]; then @@ -37,18 +37,20 @@ do_record() { ( EXACT_START_TIME=$(date +%s.%N) outfile_close_trap() { + echo trap EXACT_END_TIME=$(date +%s.%N) if [ -f $OUTFILE_START ]; then mv $OUTFILE_START dump_cam_${i}_${EXACT_START_TIME}_${EXACT_END_TIME}.mjpg fi } trap outfile_close_trap SIGINT SIGTERM EXIT - wget --ignore-length --http-user=$USERNAME --http-passwd=$PASSWORD http://${SERVER_IP}:$PORT/cam/$i/stream.mjpeg -O $OUTFILE_START -q 2>&1 >> /dev/null + wget --ignore-length --http-user=$USERNAME --http-passwd=$PASSWORD http://${SERVER_IP}:$PORT/cam/$i/stream.mjpeg -O $OUTFILE_START -q 2>&1 >> /dev/null & + THIS_WGET_PID=$! + echo $THIS_WGET_PID >> ${PIDFILE_BASE}_${1} + wait $THIS_WGET_PID ) & - WGET_PIDS="$WGET_PIDS $!" done - echo "$WGET_PIDS" > ${PIDFILE_BASE}_${1} exit 0 }