Commit 7bffcf05 authored by Roman's avatar Roman

script to download .ulg logs from nanopi remotely

parent 3eb0b79d
## скачивание .ros и .ulg логов с nanopi
В репозитории phoros добавлен скрипт, позволяющий скачивать сегодняшние логи .ulg с PX4 (/phoros/launch/install/downloadlogs.sh) через mavros ftp.
Этот скрипт может быть запущен удалённо при подключенном nano pi в сеть. Удалённый запуск с сервера по ssh с последующим скачиванием .ulg файлов уже с nano pi на сервер описан в скрипте в корне текущей директории dlnanopilogs.sh
# 1) current date (as on the server)
echo $(date +%Y-%m-%d) > /tmp/currdate.txt
if [ $? -ne 0 ]; then
echo "failed: cant copy current date, exiting"
exit 1
fi
sshpass -p "fa" scp /tmp/currdate.txt root@192.168.7.16:/tmp/currdate.txt
if [ $? -ne 0 ]; then
echo "failed: cant copy current date, exiting"
exit 1
fi
echo "Downloading logs on PX4. This may take a few minutes...."
# send command to download logs from px4 to nano pi
sshpass -p "fa" ssh root@192.168.7.16 "/root/downloadlogs.sh"
#2) on srv: scp downloaded logs
echo "done. Checking status..."
FOLDERNAME=~/pxlogs/$(cat /tmp/currdate.txt)-$(date +%s)
sshpass -p "fa" scp -r root@192.168.7.16:/tmp/downloadlogs.txt /tmp/downloadlogs.txt
if [[ -s /tmp/downloadlogs.txt ]]; then
echo "success on nano pi side. Downloading .px4 logs to $FOLDERNAME"
else
echo "fail on nano pi side. Info: $(cat /tmp/downloadlogs.txt)"
exit 1
fi
mkdir -p $FOLDERNAME
sshpass -p "fa" scp -r root@192.168.7.16:/tmp/pxlogs $FOLDERNAME
#if there is no folder with DATE, folder is named "sessXXX", where XXX starts with 001
#download phoros logs:
sshpass -p "fa" scp -r root@192.168.7.16:/root/.ros/log .
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment