From e81e6ad12cdb7ee56b88ef1fb1cc054f6ea60fe6 Mon Sep 17 00:00:00 2001 From: Satu Koskinen Date: Sat, 18 Mar 2023 15:33:22 +0200 Subject: [PATCH] Fix cron job logging, update setup docs --- docs/setup.md | 16 +++++++++++++++- scripts/setup-raspberry-pi.sh | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/setup.md b/docs/setup.md index 831b72a..b8746a6 100755 --- a/docs/setup.md +++ b/docs/setup.md @@ -81,7 +81,21 @@ nmap --version If this prints out version information about nmap (e.g. Nmap version 7.93 ( https://nmap.org)), it is installed. Otherwise, installation instructions can be found here: https://nmap.org/download.html -After installing, run the following command (it will ask for your user password, write it and press Enter) to find all devices connected to the local network: +After installing nmap, we first need to determine the subnet in which we will search for the Raspberry Pi IP address. This can be done by first determining our host device's IP address: + +``` +ip a | grep 192.168 +``` + +This should print out something similar to +``` +❯ ip a | grep 192.168 + inet 192.168.1.117/24 brd 192.168.1.255 scope global dynamic noprefixroute enp3s0 +``` + +Here, 192.168.1.117 is our own IP address. From this, we can deduce our subnet by taking the first three parts of the IP address and replacing the last part with zero, and including the subnet mask (24): `192.168.1.0/24` + +Then, run the following command (it will ask for your user password, write it and press Enter) to find all devices connected to the local network, and replace `192.168.1.0/24` with the version with your own IP address: ``` sudo nmap -sn 192.168.1.0/24 diff --git a/scripts/setup-raspberry-pi.sh b/scripts/setup-raspberry-pi.sh index b96dd71..42e526d 100644 --- a/scripts/setup-raspberry-pi.sh +++ b/scripts/setup-raspberry-pi.sh @@ -86,8 +86,8 @@ echo "### Set up a cron job to start the recordings at boot" echo CRON_FILE=/etc/crontab -CRON_LOG_FILE="$BOOT_DIR_PATH/\$(date +\"%Y-%m-%dT%H-%M-%S\")-cron-log.txt" -CRON_COMMAND="@reboot root $DIR_PATH/hydrophonitor/scripts/start-all.sh 2>&1 > $CRON_LOG_FILE" +CRON_LOG_FILE="$BOOT_DIR_PATH/cron-log.txt" +CRON_COMMAND="@reboot root $DIR_PATH/hydrophonitor/scripts/start-all.sh 2>&1 >> $CRON_LOG_FILE" # Append command to cron file only if it's not there yet if ! grep -q "$CRON_COMMAND" "$CRON_FILE"; then