/Designs/Measuring_instruments/RMDS01B/SW/Bolidozor/SpectrumLab/sync.sh
3,13 → 3,12
[[ $# -ne 1 ]] && echo "Usage: ./sync.sh /path/to/folder" && exit 1
 
# Redirect stdout ( > ) into a named pipe ( >() ) running "tee"
exec > >(tee "$1"/logfile)
exec > >(tee "$1"/logfile.txt)
 
# Also redirect stderr
exec 2>&1
 
# 9 min delay between resync
FREQUENCY=540
FREQUENCY=180
 
TIDYUP="$(pwd)/tidyup.sh"
RSYNC="$(pwd)/upload.sh"
29,8 → 28,8
EXIT=1
i=1
# while [ $EXIT -ne 0 ]; do
info "Trying to sync $1; $2; $3"
"$RSYNC" $1 $2 $3
info "Trying to sync $1, $2"
"$RSYNC" $1 $2
EXIT=$?
[ $EXIT -ne 0 ] && error "sync failed"
let i++
68,28 → 67,10
# Change working directory
cd $1
 
# first sort
tidyup $1 || error "Sort failed, please analyze logfile.txt ."
# first sync
info "Doing complete sync"
syncdir . -a
 
if [ -f "$1"/LAST ]
then
read LAST < "$1"/LAST
else
LAST="."
fi
# reset counter
HOURCOUNT=24
 
if [ -f "$1"/capture/LAST ]
then
read LAST_HOUR < "$1"/capture/LAST
else
LAST_HOUR="."
fi
 
 
# Periodically tidy up and do incremental sync
while :
do
96,55 → 77,50
# start timer
start_time=`date +%s`
OLD="$LAST"
OLD_HOUR="$LAST_HOUR"
# sort
tidyup $1 || error "Sort failed, please analyze logfile.txt ."
tidyup $1 || error "Sort failed, please send logfile.txt to toxygen1@gmail.com"
# increase counter every hour
# if 24 hour mark is hit, do daily sync
if [[ "$HOURCOUNT" -eq 24 ]]
then
info "Doing complete sync"
syncdir .
HOURCOUNT=0
fi
if [ -f "$1"/LAST ]
then
# next line is important for the first run of the loop
read LAST < "$1"/LAST
# read last processed day
read LAST < "$1"/LAST
read LAST_HOUR < "$1"/capture/LAST
# sync last updated folders
syncdir audio/"$LAST" -a
syncdir capture/"$LAST_HOUR" -a
syncdir data/"$LAST" -a
syncdir data --dirs --delete
syncdir . --dirs --delete
# days changed, sync whole yesterday too
if [ "$LAST" != "$OLD" ]
then
info "syncing yesterday"
syncdir audio/"$OLD" -a
syncdir capture/"$OLD" -a
syncdir data/"$OLD" -a
else
# hours changed, sync previous hour too
if [ "$LAST_HOUR" != "$OLD_HOUR" ]
then
info "syncing previous hour"
syncdir capture/"$OLD_HOUR" -a
fi
fi
let HOURCOUNT++
 
# read last processed day
OLD="$LAST"
read LAST < "$1"/LAST
 
# sync last updated folders
syncdir ./audio/"$LAST"
syncdir ./capture/"$LAST"
syncdir ./data/"$LAST"
syncdir ./data --delete
 
# days changed, sync yesterday too
[[ "$LAST" != "$OLD" ]] && info "syncing yesterday" && syncdir "$OLD"
 
tail -n 1000 "$1"/logfile.txt > "$1"/tmp.txt
mv "$1"/tmp.txt "$1"/logfile.txt
fi
# end timer
end_time=`date +%s`
ELAPSED=`expr $end_time - $start_time`
info "execution time was $ELAPSED s"
info "execution time was $ELAPSED s"
date
# save only tail from logfile
tail -n 1000 "$1"/logfile > "$1"/logfile.txt
rm "$1"/logfile
exec > >(tee "$1"/logfile)
exec 2>&1
 
# wait for a next syncing period
# if last sync took less than TIME, sleep to make up 1 hour
# [[ $ELAPSED -lt $FREQUENCY ]] && sleep `expr $FREQUENCY - $ELAPSED`
sleep $FREQUENCY
done
/Designs/Measuring_instruments/RMDS01B/SW/Bolidozor/SpectrumLab/upload.sh
4,7 → 4,7
#
# this script should not be called manually
 
echo "$1 ; $2 ; $3"
echo $1 , $2
echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
[[ "$#" < 1 ]] && echo "Please provide directory to upload" && exit 1
21,7 → 21,7
# could as well be changed for rsync -q, but this is more clear
if [[ -f exclude-list.txt ]]
then
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
rsync -avvtz "$2" "$UPDIR"/ --rsh='ssh -p2223' --exclude-from='exclude-list.txt' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
else
rsync -vvtz $2 $3 "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
rsync -avvtz "$2" "$UPDIR"/ --rsh='ssh -p2223' meteor@meteor1.astrozor.cz:meteors/"$STATIONNAME"/"$UPDIR"
fi
/Designs/Measuring_instruments/RMDS01B/SW/Bolidozor/SpectrumLab/SVAKOV-R2.usr
331,7 → 331,7
MaxFileSize=1400
Flags=5
FileIndex=0
TrigRecorderFile=/media/sd/meteors//SVAKOV-R2/audio/20131227111133040_SVAKOV-R2.wav
TrigRecorderFile=/media/sd/meteors//SVAKOV-R2/audio/20131215190835144_SVAKOV-R2.wav
TrigRecorderFileMode=0
PreTrigSeconds=6
PostTrigSeconds=11
685,7 → 685,7
ConnectSpectrumCh2To_Q=0
Same4AllChnls=1
RateDivisor=1
AntiAlias=0
AntiAlias=1
ZeroPadInput=0
ApplyFOCalib=0
TrigOptions=0
735,8 → 735,8
ReadCursorOpts=40
PeakDetCursor=1
UserCursorExpr1=str("hh:mm:ss.s",cursor.spectrum.time)
FreqMin=9849.97111155
FreqMax=11264.9740004
FreqMin=9664.69726841
FreqMax=12494.7030461
FreqMin2=600
FreqMax2=800
FreqOffset=0
826,7 → 826,7
WaterColorPalette=palettes\sunrise.pal
VisualAGCMode=0
VisualAGCRef=-100
ColorPalContrast=111
ColorPalContrast=105
ColorPalBrightness=168
ColorPalSaturation=128
WaterColorPalette2=palettes\sunrise.pal
1098,9 → 1098,9
InfoPos=3
InfoStk=1
InfoDef0=$"Date="+str("YYYY-MM-DD",now)+" Time="+str("hh:mm",now)+" UTC"
InfoDef1=$"Freq=143 050 000 Hz"
InfoDef2=$"Echo=10 600 Hz"
InfoDef3=K_station_name
InfoDef1=$"Freq=143.050000 MHz"
InfoDef2=$"Echo=143.0392 MHz"
InfoDef3=s0
InfoDef4=
InfoDef5=
InfoDef6=
1424,7 → 1424,7
FreqCvtSameLO=0
FreqCvtQuadLO=0
ConnectSlider1=5
Gain0=1000
Gain0=2238.72113857
Gain1=211.348903984
Gain2=1
Gain3=1
1806,7 → 1806,7
AGCCustomDecay=0.1
 
[CIRCUIT_BLACKBOX2]
CompType=20
CompType=148
BandpassFC=1400
BandpassBW=1400
BandpassRespType=0
/Designs/Measuring_instruments/RMDS01B/SW/Bolidozor/SpectrumLab/tidyup.sh
83,7 → 83,7
# check if directory really exists (if fs is full it might not be created)
[[ -d "$DAYDIR" ]] && mv "$i" "$DAYDIR"
echo -n "$YEAR$SLASH$MONTH$SLASH$DAY$SLASH$HOUR" > LAST
echo -n "$YEAR$SLASH$MONTH$SLASH$DAY" > LAST
echo -n "$YEAR$SLASH$MONTH$SLASH$DAY" > "$1"/LAST
done
else