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>
27 lines
901 B
Bash
Executable File
27 lines
901 B
Bash
Executable File
#!/bin/bash
|
|
|
|
crontabSetupCheckProcessor()
|
|
{
|
|
local task_check_script="$install_scripts_dir/crontab/task/crontab_check_processor.sh"
|
|
local task_dir="$containers_dir/libreportal/frontend/data/tasks"
|
|
|
|
# Update TASK_DIR in the task processor script
|
|
if [ -f "$task_check_script" ]; then
|
|
sed -i "s|TASK_DIR=\".*\"|TASK_DIR=\"$task_dir\"|g" "$task_check_script"
|
|
chmod +x $task_check_script
|
|
else
|
|
isNotice "Task processor checker script not found"
|
|
fi
|
|
|
|
local cronEntry="*/5 * * * * $task_check_script start_script"
|
|
|
|
# Check if already in crontab
|
|
if runAsManager crontab -l 2>/dev/null | grep -q "crontab_check_processor.sh"; then
|
|
isNotice "Task process checker already in crontab"
|
|
else
|
|
# Add to crontab
|
|
(runAsManager crontab -l 2>/dev/null; echo "$cronEntry") | runAsManager crontab -
|
|
isSuccessful "Continuous task process checker added to crontab."
|
|
fi
|
|
}
|