in a script bash, here is what I do:
- Every 3 minutes, I create binary data for one minute to get a waterfall. The following command creates two files: plot.met and plot.bin.
rtl_power_fftw -f 144100000:146100000 -b 500 -n 100 -g 350 -p 0 -e 1m -q -m plot
Then, I parse the met file and I link the content of the .met file (number of bins, number of scans, etc.) with two variables: nb_bins and nb_scans.
And I create my waterfall as a png image:
gnuplot -persist << EOF
plot 'plot.bin' binary array=${nb_bins}x${nb_scans} format='%float' with image
set term png
set output 'plot.png'
replot
set term wxt
EOF
The problem is that my plot.png image is modified during the first start of my code (bash script.sh), but then, my code is running automatically with crontab * * * * * /my/directory/script.sh and the image is then updated without any content (size of 0 bytes). While my files plot.met and plot.bin are refreshed without any problem.
I tried different things already: using gnuplot -e "" instead of gnuplot persist, without set term wxt, trying different times for crontab, killing the gnuplot process, but nothing worked yet and I don't have any other ideas. Thanks a lot for your help!

input="/my/directory/more_scans.met" n=1 while read -r "LINE$n"; do n=$((n+1)) done < "$input" for ((i=1; i<n; i++)); do nb_bins="LINE1" nb_scans="LINE2" ... done nb_freq=$(echo "${!nb_freq}" | grep -oE '[0-9]+([.][0-9]+)?')