The scoped sudoers grants the manager (root) and (dockerinstall) but NOT (itself), so the many 'sudo -u $sudo_user_name <cmd>' calls (crontab, git/update, reinstall, swapfile, …) failed with 'a password is required' once per CLI command. runAsManager runs the command plainly when already the manager (the runtime case) and only sudo -u's when root (install time), so it's correct in both contexts and needs no sudoers self-grant. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
15 lines
500 B
Bash
Executable File
15 lines
500 B
Bash
Executable File
#!/bin/bash
|
|
|
|
crontabSetup()
|
|
{
|
|
local search_line="# cron is set up for $sudo_user_name"
|
|
local cron_output=$(runAsManager crontab -l 2>/dev/null)
|
|
|
|
if [[ ! $cron_output == *"$search_line"* ]]; then
|
|
local result=$( (runAsManager crontab -l 2>/dev/null; echo "# cron is set up for $sudo_user_name") | runAsManager crontab - 2>/dev/null )
|
|
checkSuccess "Setting up Crontab for $sudo_user_name user"
|
|
fi
|
|
|
|
export VISUAL=$CFG_TEXT_EDITOR
|
|
export EDITOR=$CFG_TEXT_EDITOR
|
|
} |