Я заметил, что скрипты, которые отлично запускаются из командной строки, не работают должным образом в Anacron. Часто причина в том, что Anacron требует полного пути к командам. Есть ли способ сделать $ PATH, который Anacron использует так же, как $ PATH, который использует пользователь или su?
Я думаю, что это делается непосредственно перед командами в anacrontab в соответствии со страницами man 5 anacrontab
:
Строки назначения среды имеют вид:
blockquote>VAR = VALUE Spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The assignment takes effect from the next line to the end of the file, or to the next assignment of the same vari‐ able. Empty lines are either blank lines, line containing white-space only, or lines with white-space followed by a '#' followed by an arbitrary comment. You can continue a line onto the next line by ending it with a '\'.
Посмотрите в файле
/etc/anacrontab
:# /etc/anacrontab: configuration file for anacron # See anacron(8) and anacrontab(5) for details. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/root LOGNAME=root # These replace cron's entries 1 5 cron.daily run-parts --report /etc/cron.daily 7 10 cron.weekly run-parts --report /etc/cron.weekly @monthly 15 cron.monthly run-parts --report /etc/cron.monthly
Как видите, переменные среды устанавливаются перед командами.