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>
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Function to set up the backup entry in crontab
|
|
installSetupCrontab()
|
|
{
|
|
local entry_name="$1"
|
|
|
|
isHeader "Adding $entry_name to Crontab"
|
|
|
|
# Check to see if already instealled
|
|
if ! sudo -u $sudo_user_name crontab -l 2>/dev/null | grep -q "cron is set up for $sudo_user_name"; then
|
|
isError "Crontab is not setup"
|
|
fi
|
|
|
|
local crontab_entry="$CFG_BACKUP_CRONTAB_APP libreportal backup app schedule $entry_name"
|
|
local apps_comment="# CRONTAB BACKUP APPS"
|
|
local existing_crontab=$(sudo -u $sudo_user_name crontab -l 2>/dev/null)
|
|
|
|
# Check if the apps comment exists in the crontab
|
|
if ! echo "$existing_crontab" | grep -q "$apps_comment"; then
|
|
existing_crontab=$(echo -e "$existing_crontab\n$apps_comment")
|
|
checkSuccess "Insert the apps comment header"
|
|
fi
|
|
existing_crontab=$(echo "$existing_crontab" | sed "/$apps_comment/a\\
|
|
$crontab_entry")
|
|
checkSuccess "Insert the backup entry after the apps comment"
|
|
|
|
local result=$(echo "$existing_crontab" | sudo -u $sudo_user_name crontab -)
|
|
checkSuccess "Set the updated crontab"
|
|
|
|
crontab_full_value=$(echo "$CFG_BACKUP_CRONTAB_APP" | cut -d' ' -f2)
|
|
isSuccessful "$entry_name will be backed up every day at $crontab_full_value:am"
|
|
}
|