#!/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 }