wget wird jetzt wieder korrekt beendet
This commit is contained in:
parent
15ac52543b
commit
680a989f2a
10
Dump.sh
10
Dump.sh
|
@ -6,7 +6,7 @@ PORT=8080
|
||||||
USERNAME=admin
|
USERNAME=admin
|
||||||
PASSWORD="123456"
|
PASSWORD="123456"
|
||||||
CAMERAS="0 1 2 3 4 5 6 7 8"
|
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
|
PIDFILE_BASE=/tmp/wget_script.$RANDOM.pids
|
||||||
if [ -z "$NAME" ]; then
|
if [ -z "$NAME" ]; then
|
||||||
|
@ -37,18 +37,20 @@ do_record() {
|
||||||
(
|
(
|
||||||
EXACT_START_TIME=$(date +%s.%N)
|
EXACT_START_TIME=$(date +%s.%N)
|
||||||
outfile_close_trap() {
|
outfile_close_trap() {
|
||||||
|
echo trap
|
||||||
EXACT_END_TIME=$(date +%s.%N)
|
EXACT_END_TIME=$(date +%s.%N)
|
||||||
if [ -f $OUTFILE_START ]; then
|
if [ -f $OUTFILE_START ]; then
|
||||||
mv $OUTFILE_START dump_cam_${i}_${EXACT_START_TIME}_${EXACT_END_TIME}.mjpg
|
mv $OUTFILE_START dump_cam_${i}_${EXACT_START_TIME}_${EXACT_END_TIME}.mjpg
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
trap outfile_close_trap SIGINT SIGTERM EXIT
|
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
|
done
|
||||||
|
|
||||||
echo "$WGET_PIDS" > ${PIDFILE_BASE}_${1}
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue