batocera-maintenancelisted
Install: claude install-skill t3chnaztea/batocera-skills
# Batocera Maintenance
Keeping the cabinet healthy: running things at boot and on a schedule, backing up
what matters, and surviving version upgrades. Assumes the connection pattern and
filesystem model from `batocera-ops`.
## There is no crond — use a boot service
Batocera does **not** run a general-purpose `crond`. Don't write a crontab and
assume it fires; it won't. The mechanism for "run this at boot / on a schedule"
is a **boot service**.
Since v43, the entry point is `/userdata/system/services/custom_service` (it
replaced `/userdata/system/custom.sh`; the upgrade auto-converts an existing
`custom.sh`). A service is a script Batocera runs at boot with a `start`
argument. Enable/inspect services:
```bash
SSHB "batocera-services list"
SSHB "cat /userdata/system/services/custom_service"
```
### Scheduling without cron: the boot-loop pattern
To run something periodically, the service launches a background loop that sleeps
and re-checks. This is how the cabinet does hourly/daily/monthly work with no
cron:
```bash
# inside custom_service, on the 'start' case:
(
while true; do
# hourly re-assert (e.g. CPU governor; see batocera-tuning)
/etc/init.d/S18governor start 2>/dev/null
# once-a-day / once-a-month gating: compare a stamp file to `date`
stamp=/userdata/system/.last-monthly-backup
if [ "$(cat "$stamp" 2>/dev/null)" != "$(date +%Y-%m)" ]; then
/userdata/system/tools/backup-to-remote.sh && date +%Y-%m > "$stamp"
fi
sleep 3600
d