Skip to content

Commit

Permalink
Merge pull request #1824 from dinger1986/dinger1986-added-passwordles…
Browse files Browse the repository at this point in the history
…s-sudo-verify

added passwordless sudo verify for backup scheduling
  • Loading branch information
wh1te909 committed May 19, 2024
2 parents 868025f + 69cd348 commit cecf45a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cecf45a

Please sign in to comment.