Hello everyone,
I've read several times that /etc/crontab should never be edited, that
So, I do not edit /etc/crontab. But I would like to know how to correctly set several environnement variables for cron. For instance, PATH and LC_TIME.
I know that a solution for PATH is to use absolute paths in the crontab. But I've noticed it can be tricky because all commands you call from inside the personnal scripts that you call in the crontab must also be called from absolute paths. Otherwise you get a script that works perfectly well from a shell but that seems to silently fail or to behave weirdly when called from
Also, although I haven't tested this solution, it seems to be possible to use
So, outside of these solutions, is there a correct and safe way to set the PATH for crontab?
Have a nice day,
QZ
I've read several times that /etc/crontab should never be edited, that
crontab -e must be used instead.So, I do not edit /etc/crontab. But I would like to know how to correctly set several environnement variables for cron. For instance, PATH and LC_TIME.
I know that a solution for PATH is to use absolute paths in the crontab. But I've noticed it can be tricky because all commands you call from inside the personnal scripts that you call in the crontab must also be called from absolute paths. Otherwise you get a script that works perfectly well from a shell but that seems to silently fail or to behave weirdly when called from
cron.Also, although I haven't tested this solution, it seems to be possible to use
setenv at the beginning of the crontab line, but I would like to avoid proceeding this way, just as a matter of readability (I would like to set several environnement variables).So, outside of these solutions, is there a correct and safe way to set the PATH for crontab?
Have a nice day,
QZ