You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CubeSatSim/log

85 lines
2.9 KiB

#!/bin/bash
echo -e "\nLog file script for CubeSatSim\n"
if [ "$1" = "-h" ] ; then
echo "Displays systemd logs for the chose process. The choices are:"
echo " -d cubesatsim (also no choice gives you this)"
echo " -t transmit"
echo " -c command and control"
echo " -p pacsat"
echo " -r frequency control"
echo " -f frequency display"
echo "Default is the log is dumpted to the screen and written to a file."
echo "If an additional r is included, the log is realtime, and exits with a Control-C"
echo
exit
fi
REALTIME=0
if [ "$2" = "r" ] ; then
REALTIME=1
fi
if [ "$REALTIME" = "1" ] ; then
echo "To exit, type Control-C"
echo
sleep 2
if [ "$1" = "-t" ] ; then
sudo journalctl -af -u transmit # > /home/pi/CubeSatSim/logt.txt
# cat /home/pi/CubeSatSim/logt.txt
# echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
elif [ "$1" = "-c" ]; then
sudo journalctl -af -u command # > /home/pi/CubeSatSim/logc.txt
cat /home/pi/CubeSatSim/logc.txt
# echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
elif [ "$1" = "-p" ]; then
sudo journalctl -af -u pacsatsim # > /home/pi/CubeSatSim/logp.txt
cat /home/pi/CubeSatSim/logp.txt
# echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logp.txt"
elif [ "$1" = "-r" ]; then
sudo journalctl -af -u frequency # > /home/pi/CubeSatSim/logr.txt
elif [ "$1" = "-f" ] ; then
while true; do
cat /home/pi/CubeSatSim/frequency.txt | tr -d '\n'
# echo
sleep 1
printf "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
done
else
sudo journalctl -af -u cubesatsim # > /home/pi/CubeSatSim/log.txt
# cat /home/pi/CubeSatSim/log.txt
# echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
fi
else
if [ "$1" = "-t" ] ; then
sudo journalctl -a -u transmit > /home/pi/CubeSatSim/logt.txt
cat /home/pi/CubeSatSim/logt.txt
echo -e "\nTransmit Log file also saved as /home/pi/CubeSatSim/logt.txt"
elif [ "$1" = "-c" ]; then
sudo journalctl -a -u command > /home/pi/CubeSatSim/logc.txt
cat /home/pi/CubeSatSim/logc.txt
echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logc.txt"
elif [ "$1" = "-p" ]; then
sudo journalctl -a -u pacsatsim > /home/pi/CubeSatSim/logp.txt
cat /home/pi/CubeSatSim/logp.txt
echo -e "\nCommand and Control Log file also saved as /home/pi/CubeSatSim/logp.txt"
elif [ "$1" = "-r" ]; then
sudo journalctl -a -u frequency > /home/pi/CubeSatSim/logr.txt
cat /home/pi/CubeSatSim/logr.txt
echo -e "\nFrequency Log file also saved as /home/pi/CubeSatSim/logf.txt"
elif [ "$1" = "-f" ] ; then
cat /home/pi/CubeSatSim/frequency.txt
echo
else
sudo journalctl -a -u cubesatsim > /home/pi/CubeSatSim/log.txt
cat /home/pi/CubeSatSim/log.txt
echo -e "\nLog file also saved as /home/pi/CubeSatSim/log.txt"
fi
fi

Powered by TurnKey Linux.