Merge pull request #1824 from dinger1986/dinger1986-added-passwordless-sudo-verify

added passwordless sudo verify for backup scheduling
This commit is contained in:
Dan 2024-05-18 22:28:22 -07:00 committed by GitHub
commit cecf45a698
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,11 @@ if [ $EUID -eq 0 ]; then
fi
if [[ $* == *--schedule* ]]; then
if ! sudo -n true 2>/dev/null; then
echo -ne "${RED}Error: Passwordless sudo is required for scheduling.${NC}\n"
exit 1
fi
(
crontab -l 2>/dev/null
echo "0 0 * * * /rmm/backup.sh --auto > /dev/null 2>&1"