Scripting & Automation (Raspberry Pi 5) · Hourly Network Scanner

Hourly Network Scan with Bash

Build a Bash-based network scanner on Raspberry Pi 5 and schedule it to run hourly with cron to log newly discovered devices.

The flow: create the script → make it executable → validate outputs → schedule hourly with crontab. Screenshots below show each step.

1) Create the Bash Script

Use the nano text editor to create the script file.

Creating script with nano

2) Script Logic

Define variables and the subnet to scan, run nmap to list active IPs, process results with conditionals, then copy the temp device list into a running scan log.

Network scan script content in editor

3) Make the Script Executable

chmod making script executable

4) View the Script

Concatenate to verify what will run.

Concatenated script output

5) Test the Script

First execution of the scan script

6) Check Scan Data

Concatenate logs to confirm new entries.

Concatenated scan data results

7) Schedule Hourly with Cron

Opening crontab
Open the crontab editor.
Crontab entry for hourly scan
Add an hourly entry (e.g., 0 * * * * /path/to/scan.sh).

Back to Home