From bf492e2f507c6f64dd69775a8ef3689f79410e53 Mon Sep 17 00:00:00 2001 From: Harry Ho Date: Mon, 22 Feb 2021 17:41:48 +0800 Subject: [PATCH] Add MCH control/logging scripts --- mch_start | 19 +++++++++++++++++++ mch_stop | 12 ++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 mch_start create mode 100644 mch_stop diff --git a/mch_start b/mch_start new file mode 100644 index 0000000..f0b3894 --- /dev/null +++ b/mch_start @@ -0,0 +1,19 @@ +#!/bin/sh + +# Power on MCH +python3 ~/power_strip/on.py + +# Get power-on time & date +TIMESTAMP=$(date '+%Y%m%d%H%M%S') + +# Start `screen`ing Metlino and Saymas in detached mode and with logging +sleep 1 +screen -dmS metlino -L -Logfile /home/pi/mlabs-testsuite/logs/metlino-$TIMESTAMP.log /dev/metlino 115200 +sleep 6 +screen -dmS sayma1amc -L -Logfile /home/pi/mlabs-testsuite/logs/sayma1-$TIMESTAMP-amc.log /dev/sayma1AMC 115200 +screen -dmS sayma1rtm -L -Logfile /home/pi/mlabs-testsuite/logs/sayma1-$TIMESTAMP-rtm.log /dev/sayma1RTM 115200 +screen -dmS sayma2amc -L -Logfile /home/pi/mlabs-testsuite/logs/sayma2-$TIMESTAMP-amc.log /dev/sayma2AMC 115200 +screen -dmS sayma2rtm -L -Logfile /home/pi/mlabs-testsuite/logs/sayma2-$TIMESTAMP-rtm.log /dev/sayma2RTM 115200 +echo "New logs has started." + +# This Shell script ends after spawning the `screen` sessions diff --git a/mch_stop b/mch_stop new file mode 100644 index 0000000..bdcc190 --- /dev/null +++ b/mch_stop @@ -0,0 +1,12 @@ +#!/bin/sh + +# Quit all `screen` sessions for Metlino and Saymas +screen -S metlino -X quit +screen -S sayma1amc -X quit +screen -S sayma1rtm -X quit +screen -S sayma2amc -X quit +screen -S sayma2rtm -X quit +echo "All logging has stopped." + +# Power off MCH +python3 ~/power_strip/off.py