wget wird jetzt wieder korrekt beendet

This commit is contained in:
root 2012-03-29 17:46:29 +02:00
parent 15ac52543b
commit 680a989f2a
1 changed files with 6 additions and 4 deletions

10
Dump.sh
View File

@ -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
}