Skip to content

About

Dependency-free shell tools for field engineers on PLCs, industrial gateways and Linux edge devices.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔧 Field Tools

Simple, opinionated shell tools for field engineers on industrial gateways, PLCs, and Linux edge devices.

License: MIT Language: Shell Platform: Linux Tools: grep · ping · tar Status: Active PRs: Welcome

Built to be read, not just run.


Overview

Field Tools is a collection of small, dependency-free shell scripts built from the ground up for the daily reality of a field engineer: standing in front of an industrial gateway or PLC, one laptop, and no cell signal. Each tool does one thing, does it plainly, and drops a clean, timestamped artifact you can paste into a work order or hand to a site report.

The scripts are deliberately boring — no config files, no frameworks, no bloat. Just grep, ping, tar, date, and a for loop. They run on any Linux box or WSL and are easy enough to read and modify on site.


📑 Contents


🚀 Quick Start

git clone https://github.com/AdamMostofi/field-tools.git
cd field-tools
chmod +x scripts/*.sh

Then run any script with ./scripts/<name>.sh.

Note for WSL users: if you see bad interpreter: no such file or directory, your file has Windows line endings. Convert with sed -i 's/\r$//' scripts/*.sh.


🛠️ The Scripts

log-alert-finder.sh — Log Triage

For anyone sifting through a noisy log to find the one line that matters.

basic count

What it does

Filters any log file for the problem lines (error, warning, failed), counts them, numbers them, and writes a timestamped summary report you can hand straight to a report.

Who it's for

  • Field engineers triaging a crashing gateway or edge device.
  • Anyone with a 50k-line log and no time to read it all.

Use cases

  • Isolate erroring lines before a diagnostic call.
  • Build a timestamped error report for a work order or vendor ticket.
  • Verify a fix landed — rerun and confirm the count dropped to zero.

How it works

./scripts/log-alert-finder.sh <log-file>

Pass any readable file. It prints the match count and a report (alert-summary-YYYY-MM-DD_HHMMSS.txt):

Scan of /var/log/syslog on Mon Aug  3 14:02 EEST 2026 - 2 matching lines
----------------
12: failed to open config
17: disk error on sda1

Exit codes — 0 found matches / success, 1 no file argument given (prints usage).


field-node-check.sh — Node Diagnostics

For the first ten minutes on site, before you touch a single setting.

ping df ip

What it does

Runs a one-shot diagnostic sweep and appends every result into a single timestamped log (node-YYYY-MM-DD_HHMMSS.log) you can hand straight to a field report. It builds a logs/ folder next to itself, lists active IP interfaces, pings the key gateways, and records disk and memory state.

Who it's for

  • Field engineers arriving on site and needing a pre-change baseline in minutes.
  • Anyone proving connectivity or drive health for a work ticket.

Use cases

  • Pre-change baseline before touching firmware or settings.
  • Connectivity proof for a work order (gateway + public DNS reachability).
  • Drive-space check before a firmware push.

How it works

./scripts/field-node-check.sh

No arguments needed — the script finds its own logs/ folder and writes a timestamped report. Sample output (logs/node-2026-08-03_142530.log):

FIELD NODE CHECK - Mon Aug  3 14:25:30 EEST 2026
Host: DESKTOP-2901Q34
[ACTIVE IP INTERFACES]
2: eth0    inet 172.26.71.187/20 brd 172.26.79.255 scope global eth0
[GATEWAY PING TEST]
FAIL: 172.26.64.1 unreachable
OK:   8.8.8.8 reachable
OK:   1.1.1.1 reachable
[DISK USAGE]
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdd       1007G   43G  914G   5% /
[MEMORY]
               total        used        free      shared  buff/cache   available
Mem:           7.6Gi       1.7Gi       5.1Gi        22Mi       1.0Gi       6.0Gi

config-backup.sh — Configuration Backups

For the golden rule of field work: before you update firmware or change settings, back it up.

tar verify

What it does

Archives a target file or folder into a timestamped gzip-compressed archive (config_backup_YYYY-MM-DD_HHMMSS.tar.gz), files it in a backups/ folder next to the script, then verifies the archive actually exists with an if [ -f ] check before reporting success.

Who it's for

  • Field engineers updating firmware or modifying settings on industrial gateways or edge devices.
  • Anyone who needs proof a config is safe before touching a device.

Use cases

  • Config backup before a firmware update or settings change.
  • One-file snapshot of a whole config folder for later restore.
  • Verifiable restore-point handed to a site report.

How it works

./scripts/config-backup.sh /etc/network/interfaces

Pass a file or directory. Output:

Backup created: ./scripts/backups/config_backup_2026-08-03_143201.tar.gz

Verify contents without extracting:

tar -tzf scripts/backups/config_backup_*.tar.gz     # → etc/hosts etc.

The [ -f ] check refuses to print success until the archive exists on disk — a silently failed backup is worse than no backup.

Exit codes — 0 archive verified, 1 no target given or archive missing.


subnet-scanner.sh — Subnet IP & Port Sweep

For the moment you arrive at a new site with dozens of devices and no map.

ping https://github.com/dev/tcp

What it does

Takes a /24 subnet prefix (e.g. 192.168.1), pings every address from .1 to .254, logs every alive device to active_devices.txt, then probes each live host for the ports that matter on industrial networks: 502 (Modbus TCP), 80 and 443 (web UIs).

Who it's for

  • Field engineers arriving at a new site and needing a quick device map.
  • Anyone mapping a network before making changes — what's up, what's listening.

Use cases

  • First-on-site network discovery for a new job.
  • Identifying Modbus-capable devices (port 502) before starting SCADA/PLC work.
  • Auditing which web interfaces are exposed (80/443) and need hardening.
  • Verifying no rogue devices after a security sweep.

How it works

./scripts/subnet-scanner.sh 192.168.1

Outputs discovered hosts and open ports:

Scanning 192.168.1.1-254 for active devices...
ACTIVE: 192.168.1.1
ACTIVE: 192.168.1.50
ACTIVE: 192.168.1.120
Active devices found: 3
Probing ports 502/80/443 on live devices...
OPEN:  192.168.1.50:502
OPEN:  192.168.1.1:80
OPEN:  192.168.1.120:443
Done. Active devices saved to active_devices.txt

🗺️ Roadmap

Status Script Purpose
✅ Built log-alert-finder.sh Isolate errors/warnings/failed out of any log.
✅ Built field-node-check.sh On-site node diagnostic sweep (IP, ping, disk).
✅ Built config-backup.sh Dated tar backups with [ -f ] verification.
✅ Built subnet-scanner.sh /24 IP sweep + industrial port checks.

📄 License

Distributed under the MIT License. Free to use, modify, and share — keep the tools in the hands of anyone in the field who needs them.


Made for the field. Kept simple on purpose.

About

Dependency-free shell tools for field engineers on PLCs, industrial gateways and Linux edge devices.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages