Can someone guide me how to copy the IQ-samples via scp to another computer after reception completed.
How can I create a script which copies the data like “scp iq-file pi@ip-address:/path…”?
The ssh authorization is not the problem but how to to setup a script.
It looks like you can provide the satnogs-client with a post observation script through the SATNOGS_POST_OBSERVATION_SCRIPT environment variable (or set it through satnogs-setup). It’s not clear if file name information based on the observation ID is available, but otherwise you could rename it in your observation script and rsync the iq.dat file over to another computer.
I did some testing but run into the problem that the script is executed as the user satnogs, which is not a general user login, so you can not set ssh authorization.
Someone may know away around it. Otherwise you could move the IQ file to the user (pi) home directory and have a cron job that syncs it to another machine.
Note though that the observation ID and start time are available in the observer.py script that runs the post observation script. My only worry is that if the IQ file has the generic name iq.dat that it will be overwritten if a new decoder/demodulator starts before the post observation script is executed.
BTW: The problem doesn’t appear when I invoke the script as root with sudo -u satnogs -g satnogs post.sh, only when invoked as POST_OBSERVATION_SCRIPT.
as a workaround, may be you can try:
date “+%Y%m%d%H%M%S.dat” | xargs mv -v iq.dat
or may be escape the back-quote with anti-slash because there seems to be some
early evaluation of back-quotes somewhere, but it would be better to understand.
The logger command in my post.sh gives the following output in /var/log/messages.log:
Are these debug messages of the boost library which are prefixed to the date?
#### post.sh linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown#012#012linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown#012#012linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown 20180509143512.dat finished. 999 ####
Don’t you have somewhere (.bashrc .bash_login, any profile file in home dir or in /etc/profile*)
a command “uname” which seems to be evaluated when bash starts a subshell (with $() or backquotes).
BTW: check with the bash man page but what you may want to do is 2>&1 >> log.txt
(which is counter intuitive)
It appears the linux; GNU C++ version 6.2.0 20161010; Boost_106100; UHD_003.009.005-0-unknown precedes any command that’s being run. You could try something like date +%FT%T | tail -n1 to get the last line.