From 53ac7a626db9deb86203c2cad7c740159a07500d Mon Sep 17 00:00:00 2001 From: ljkeller Date: Sun, 7 Apr 2024 16:31:10 +0000 Subject: [PATCH] Nice-to-have scripts/changes These scripts should help noobs --- app/iot/secrets-template.json | 6 +++--- utils/check_internet.sh | 2 ++ utils/check_iot_keys.sh | 14 ++++++++++++++ utils/follow_service_logs.sh | 1 + utils/get_service_status.sh | 5 +++++ utils/restart_service.sh | 1 + 6 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 utils/check_internet.sh create mode 100755 utils/check_iot_keys.sh create mode 100755 utils/follow_service_logs.sh create mode 100755 utils/get_service_status.sh create mode 100755 utils/restart_service.sh diff --git a/app/iot/secrets-template.json b/app/iot/secrets-template.json index 8d108e5..ac55d16 100644 --- a/app/iot/secrets-template.json +++ b/app/iot/secrets-template.json @@ -5,10 +5,10 @@ "caPath": "/opt/SPARK/iot/.pem" }, "ids": { - "uniqueId": "", - "sid": "" + "uniqueId": "DEVICE NAME", + "sid": "FOUND IN ORGANZIATION KEY VAULT UNDER SDK VERSION" }, "networking": { - "discoveryUrl": "" + "discoveryUrl": "FOUND IN ORGANIZATION KEY VAULT" } } diff --git a/utils/check_internet.sh b/utils/check_internet.sh new file mode 100755 index 0000000..5f8b40a --- /dev/null +++ b/utils/check_internet.sh @@ -0,0 +1,2 @@ +echo "Pinging google to see if internet is available..." +ping 8.8.8.8 diff --git a/utils/check_iot_keys.sh b/utils/check_iot_keys.sh new file mode 100755 index 0000000..9781a4c --- /dev/null +++ b/utils/check_iot_keys.sh @@ -0,0 +1,14 @@ +echo "Printing SPARK iotc related files at /opt/spark/iot/" +echo "------------------------------------------" +find /opt/spark/iot/ -type f +echo "------------------------------------------" + +echo "IoT service secrets.json file content" +echo "------------------------------------------" +cat /opt/spark/iot/secrets.json +if [ $? -ne 0 ]; then + echo "secrets.json file not found. Ensure it exists in /opt/spark/iot/ directory" +fi +echo "------------------------------------------" + +echo "Please cross reference the files and secrets.json to ensure all dependencies exist" diff --git a/utils/follow_service_logs.sh b/utils/follow_service_logs.sh new file mode 100755 index 0000000..40f022d --- /dev/null +++ b/utils/follow_service_logs.sh @@ -0,0 +1 @@ +journalctl -u iotc-spark-server.service -f diff --git a/utils/get_service_status.sh b/utils/get_service_status.sh new file mode 100755 index 0000000..9ca7c8a --- /dev/null +++ b/utils/get_service_status.sh @@ -0,0 +1,5 @@ +echo "Checking iotc-spark-server.service status..." +systemctl list-units --type=service --all | grep -i iotc-spark-server.service + +echo "Checking iotc-spark-server.service logs..." +journalctl -u iotc-spark-server.service diff --git a/utils/restart_service.sh b/utils/restart_service.sh new file mode 100755 index 0000000..60f4495 --- /dev/null +++ b/utils/restart_service.sh @@ -0,0 +1 @@ +systemctl restart iotc-spark-server.service