From e693e5c4894bb79b5736f422fbcf042682627a81 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 22 Jun 2024 19:26:38 +1000 Subject: [PATCH] fix: Use dir to allow mounting --- logs/monitor.log | 1 + main.go | 2 +- test.sh | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 logs/monitor.log diff --git a/logs/monitor.log b/logs/monitor.log new file mode 100644 index 0000000..5c3a341 --- /dev/null +++ b/logs/monitor.log @@ -0,0 +1 @@ +Latest Check: Sat 22 Jun 2024 19:26:28 AEST diff --git a/main.go b/main.go index ecb768b..e83df96 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ import ( "github.com/joho/godotenv" ) -const logFilePath = "monitor.log" +const logFilePath = "logs/monitor.log" const testFilePath = "test.sh" func main() { diff --git a/test.sh b/test.sh index 46a7340..cd8940a 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Make log dir +mkdir -p logs + # Check if script has IP address as argument if [ -z "$1" ]; then # Get Node IPs @@ -28,12 +31,12 @@ check_dig() { else echo "$(date) - $1 failed for NODE_IP=$NODE_IP" # Save the failed IP - echo "$(date) - $1 failed for NODE_IP=$NODE_IP" >> monitor.log + echo "$(date) - $1 failed for NODE_IP=$NODE_IP" >> logs/monitor.log fi } # Save test time -echo "Latest Check: $(date)" >> monitor.log +echo "Latest Check: $(date)" >> logs/monitor.log # Loop over each IP and run the dig commands