LibrePortal/scripts/crontab/app/crontab_check_backup_app.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

22 lines
653 B
Bash
Executable File

#!/bin/bash
checkBackupCrontabApp()
{
local name="$1"
local config_variable="CFG_${name^^}_BACKUP"
local desired="${!config_variable}"
local has_cron=0
if sudo -u $sudo_user_name crontab -l 2>/dev/null | grep -q "$name"; then
has_cron=1
fi
if [[ "$desired" == "true" && $has_cron -eq 0 ]]; then
installSetupCrontab "$name"
databaseCronJobsInsert "$name"
isSuccessful "Backup crontab enabled for $name."
elif [[ "$desired" == "false" && $has_cron -eq 1 ]]; then
removeBackupCrontabApp "$name"
isSuccessful "Backup crontab removed for $name (disabled in config)."
fi
}