6d0b48797a
This host has no cron daemon (it is systemd-based), so schedule export-runner.sh via a
systemd timer rather than cron. cron-export.sh wraps the run with a sane PATH, flock
serialisation (no overlapping runs), and per-run logs under runtime/logs/. The timer is
Persistent, so a 03:30 run missed because the machine was asleep/off is caught up on the
next boot -- which plain cron does not do.
- scripts/cron-export.sh: scheduled-run wrapper.
- deploy/systemd/ctrader-export.{service,timer}: the units (install: sudo cp into
/etc/systemd/system/ then enable -- see deploy/systemd/README.md).
32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# Scheduled export (systemd timer)
|
|
|
|
Runs `scripts/export-runner.sh` once a day at **03:30** via a systemd timer (this host
|
|
has no cron daemon; the timer is native and, unlike cron, catches up a missed run with
|
|
`Persistent=true` if the machine was asleep/off at 03:30).
|
|
|
|
`ctrader-export.service` runs `scripts/cron-export.sh` as user `brummel` (a wrapper that
|
|
sets a sane PATH, serialises with `flock`, and logs into `runtime/logs/`).
|
|
|
|
## Install (one-time, needs sudo)
|
|
|
|
```bash
|
|
sudo cp deploy/systemd/ctrader-export.service deploy/systemd/ctrader-export.timer \
|
|
/etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable --now ctrader-export.timer
|
|
```
|
|
|
|
## Verify / operate
|
|
|
|
```bash
|
|
systemctl list-timers ctrader-export.timer # next/last fire time
|
|
systemctl status ctrader-export.service # last run result
|
|
journalctl -u ctrader-export.service # service-level logs
|
|
ls -t runtime/logs/ # per-run export logs
|
|
sudo systemctl start ctrader-export.service # run once now, on demand
|
|
sudo systemctl disable --now ctrader-export.timer # stop scheduling
|
|
```
|
|
|
|
Paths in the unit files are absolute (`/home/brummel/dev/cTrader`). If the repo moves,
|
|
update `ExecStart` in `ctrader-export.service` and re-run the install steps.
|