Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 3.06 KB

File metadata and controls

76 lines (55 loc) · 3.06 KB

OpsCommandCenter Android Agent (Termux)

No SDK, no APK, no Android Studio. A plain shell script running inside Termux reports the phone's basic health to the same dashboard the Windows/Linux agents use.

Status: written and syntax-checked, but not run on a real Android device from the session that built it — no phone/emulator was available. Same honesty bar as the rest of this project's deployment guides: treat the first real run as the first real test.

1. Install Termux + Termux:API

Install both from F-Droid (recommended — the Play Store build of Termux is outdated and unmaintained):

  • Termux
  • Termux:API (optional, only needed for battery readings — everything else works without it)

Open Termux and run:

pkg update && pkg install curl termux-api

2. Get the script onto the phone

Easiest path: open this file's raw URL from the GitHub release/repo in the phone's browser and save it, or curl it directly from Termux once you know where it's hosted, e.g.:

curl -o opscc-agent.sh https://raw.githubusercontent.com/unupunct/OpsCommandCenter/main/src/OpsCommandCenter.Agent.Android/opscc-agent.sh
chmod +x opscc-agent.sh

3. Run it

First run needs the server address (saved automatically for next time):

./opscc-agent.sh --server=http://<server-ip>:5252 --interval=30

Optional --name=my-phone sets a friendly device name; otherwise it auto-generates one from the device model + a stable per-device ID (needed because the dashboard requires unique computer names, and two identical phone models would otherwise collide).

Leave this running in the Termux session — it loops forever, posting a heartbeat every --interval seconds, until you press Ctrl+C.

4. Keep it running

Android aggressively kills background apps to save battery. Two things help:

  • termux-wake-lock: the script calls this automatically at startup if Termux:API is installed — prevents Android from suspending Termux while a wake lock is held.

  • Termux:Boot (separate app, F-Droid link): install it, then create ~/.termux/boot/opscc-agent containing:

    #!/data/data/com.termux/files/usr/bin/bash
    termux-wake-lock
    cd ~
    ./opscc-agent.sh

    (chmod +x it too.) This starts the agent automatically when the phone boots, without needing to manually open Termux each time.

What it reports

Device model, Android version/build, CPU (best-effort — Android doesn't expose a clean single CPU model string to unprivileged apps, so this falls back to the CPU ABI like arm64-v8a), RAM, uptime, battery %, and full-disk encryption state (ro.crypto.state — a genuine analog of BitLocker, both being OS-level disk encryption). Not reported (left as "n/a" on the dashboard, never guessed): disk health/wear, disk temperature, antivirus status — none of these have a meaningful equivalent reachable from an unprivileged Termux shell.