Zeitstempel verbessert

This commit is contained in:
root 2012-03-29 16:19:07 +02:00
parent 319b653d11
commit 22dc449836
1 changed files with 12 additions and 7 deletions

19
Dump.sh
View File

@ -33,14 +33,19 @@ trap 'quit 0' SIGINT SIGTERM EXIT
do_record() {
for i in $CAMERAS; do
echo "starting recording for camera $i" >&2
OUTFILE_START=dump_cam${i}_$(date +%s)
( 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=$!
(
while ps -p $THIS_WGET_PID >> /dev/null 2>&1; do sleep 1; done
mv $OUTFILE_START ${OUTFILE_START}_$(date +%s).mjpg
OUTFILE_START=tmp_dump_cam_${i}_$(date +%s)_RANDOM$RANDOM.mjpg
(
EXACT_START_TIME=$(date +%s.%N)
outfile_close_trap() {
EXACT_END_TIME=$(date +%s.%N)
touch $OUTFILE_START
mv $OUTFILE_START dump_cam_${i}_${EXACT_START_TIME}_${EXACT_END_TIME}.mjpg
echo trapped
}
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_PIDS="$WGET_PIDS $THIS_WGET_PID"
WGET_PIDS="$WGET_PIDS $!"
done
echo "$WGET_PIDS" > ${PIDFILE_BASE}_${1}