Fix agent install/uninstall sudo placement, add dependency install hints

curl ... | API_URL=... bash runs as the invoking user, not root, so
"sudo" has to go right after the pipe (elevating bash) rather than
before curl — the old commands in the app UI, README, and scripts'
own usage comments put it in a spot that still failed the root check.
Also have install.sh/report-tasks.sh suggest the right package-manager
command (apt/dnf/yum/apk/pacman/zypper) when curl or jq is missing
instead of just failing, and bring the README up to date with both.
This commit is contained in:
bobban committed 2026-09-02 23:12:12 +02:00
1 parent 0615866311
commit 329dcab936
5 files changed
+71 -18

No files matched your search

+12 -6
View File
@@ -11,8 +11,9 @@ support is a documented future addition — see [`agent/windows/README.md`](agen
- `server/` — Express + TypeScript API, SQLite (via libSQL) storage, Authentik OIDC login.
- `web/` — React + Vite single-page app, served as static files by the Express server.
- `agent/linux/` — `report-tasks.sh` (collects cron + systemd timer data) and
`install.sh` (installs it as a systemd timer on a target server).
- `agent/linux/` — `report-tasks.sh` (collects cron + systemd timer data),
`install.sh` (installs it as a systemd timer on a target server), and
`uninstall.sh` (removes it).
Data model, API contract, and sync behavior are documented in code:
[`server/src/db/schema.ts`](server/src/db/schema.ts),
@@ -64,11 +65,13 @@ automatically on server start.
1. Sign in, go to **Servers**, and add a server. The generated API token is
shown once — copy it.
2. On the target Linux server (as root):
2. On the target Linux server, as root. If you're not already root, put
`sudo` right after the pipe so it elevates `bash`, not `curl` — `sudo curl
... | bash` would still fail the root check:
```sh
curl -fsSL https://schedule.example.lan/agent/linux/install.sh | \
API_URL=https://schedule.example.lan API_TOKEN=stm_xxx bash
sudo API_URL=https://schedule.example.lan API_TOKEN=stm_xxx bash
```
This installs `report-tasks.sh` to `/usr/local/bin`, writes the API
@@ -76,7 +79,10 @@ automatically on server start.
`schedule-task-manager-agent.timer` systemd timer that reports every 15
minutes (override with `INTERVAL_MINUTES=5` before the `bash` above).
Requires `curl`, `jq`, and `systemd` on the target server.
Requires `curl`, `jq`, and `systemd` on the target server — if either
`curl` or `jq` is missing, both this script and `report-tasks.sh` print
the right install command for the server's package manager (apt, dnf,
yum, apk, pacman, or zypper) and exit.
3. Tasks appear on the Dashboard, grouped by server and then by schedule type,
within one reporting interval.
@@ -88,7 +94,7 @@ hidden by default — toggle "Show stale/missing tasks" to see them.
To remove the agent from a server, run:
```sh
curl -fsSL https://schedule.example.lan/agent/linux/uninstall.sh | bash
curl -fsSL https://schedule.example.lan/agent/linux/uninstall.sh | sudo bash
```
This stops and deletes the systemd timer/service, the installed script, and