From 9bb0dbac56135556156d01b2867ef50ccd8ce8ed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sat, 28 Feb 2026 18:14:37 -0500 Subject: [PATCH] Update log with -h and r option for realtime --- log | 74 ++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 18 deletions(-) diff --git a/log b/log index f5b301c5..55f3c9c1 100755 --- a/log +++ b/log @@ -2,26 +2,64 @@ echo -e "\nLog file script for CubeSatSim\n" -echo "To exit, type Control-C" +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 "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 -echo +if [ "$REALTIME" = "1" ] ; then -sleep 2 + echo "To exit, type Control-C" + echo + sleep 2 + + if [ "$1" = "-r" ] || [ "$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" + 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 -if [ "$1" = "-r" ] || [ "$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" 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" + + if [ "$1" = "-r" ] || [ "$1" = "-t" ] ; then + sudo journalctl -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 -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 -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" + else + sudo journalctl -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