LibrePortal/scripts/start/start_other.sh
librelad 4ce0340ef8 refactor(backup): replace per-app cron stagger with task-queue scheduler
Application backups were driven by one crontab entry per app, each offset by
id * CFG_BACKUP_CRONTAB_APP_INTERVAL minutes. That minute offset is written
straight into cron's 0-59 minute field, so past ~20 apps it overflowed into
an invalid entry that silently never fired, and the fixed spacing could not
serialize backups that ran longer than the gap.

Replace it with a single daily entry (`libreportal backup scheduled`) that
enqueues a backup task per enabled app. The existing systemd task processor
drains them serially — no minute overflow, real serialization, and backups
are now visible/cancellable in the Tasks UI. Per-app enable is read from
CFG_<APP>_BACKUP at schedule time instead of being mirrored into crontab.

Removes the stagger machinery (timing/setup/check/remove scripts), the
now-unused cron_jobs table + insert, and the CFG_BACKUP_CRONTAB_APP_INTERVAL
config knob and its WebUI field.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-22 14:34:35 +01:00

73 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
startOther()
{
#######################################################
### Backup / Restore / Migrate ###
#######################################################
databaseCycleThroughListApps;
#######################################################
### Tools ###
#######################################################
if [[ "$toolsetupsshkeys" == [yY] ]]; then
installSSHKeysForDownload tool;
fi
if [[ "$toolsresetgit" == [yY] ]]; then
gitFolderResetAndBackup;
fi
if [[ "$toolstartpreinstallation" == [yY] ]]; then
startPreInstall;
fi
if [[ "$toolrestartcontainers" == [yY] ]]; then
dockerStartAllApps;
fi
if [[ "$toolstopcontainers" == [yY] ]]; then
dockerStopAllApps;
fi
if [[ "$toolsstartcrontabsetup" == [yY] ]]; then
crontabSetupBackupScheduler
fi
if [[ "$toolinstallcrontab" == [yY] ]]; then
installCrontab
fi
#######################################################
### Database ###
#######################################################
databaseRemoveFile;
databaseListAllApps;
databaseDisplayTables;
if [[ "$toollistinstalledapps" == [yY] ]]; then
databaseListInstalledApps;
fi
if [[ "$toolupdatedb" == [yY] ]]; then
databaseAppScan;
fi
databaseEmptyTable;
#######################################################
### Headscale ###
#######################################################
headscaleCommands;
if [[ "$headscaleconfigfile" == [yY] ]]; then
headscaleEditConfig;
fi
endStart;
}