Subj : Re: Cron To : Al From : hal Date : Mon Mar 08 2021 03:14 pm Al> ac> Sourcing /etc/profile should also work but it would include other stu Al> ac> that might not be needed. And sourcing a bash_profile from the home Al> Sourcing your own .bash_profile (if you have one, I don't) will result Al> in cron having the usual user environment, if that is what you want. Ahh the old question .bashrc or .bash_profile (but not quite) OUTSIDE OF CRON ... ..bash_profile is used for login shells. .bashrc is used for shells that are both interactive and non-login Cron should run in a non-login shell but it is also non-interactive and therefore bash ignores both of these startup files The bash(1) manpage puts it /etc/profile system wide execution for login shells ~/.bash_profile personal initialization for login shells (initialized once per terminal) ~/.bashrc individual PER interactive shell (initialized on every sub shell as well) INSIDE CRON ... Cron ignores ALL startup scripts. Period. So adding stuff in the normal places won't work. The normal recommendations are to (1) rather than put a command on the command line of the crontab entry but put a script and ensure that the script declares exactly what it needs to run correctly. This has the advantage over (2) in that if you mess around with your ..bash_profile or .bashrc and you are sourcing that then your batch jobs are not messed up (which are usually much more important). (2) place the settings in .bash_profile or .bashrc and then source them. This ends up outputting potentially a lot into the cron logs that don't need to be there. In addition the more commands and settings you have in your startup scripts the more chance of messing up what should be a simple script. (3) put the settings in a seperate file and source that. But then why bother just place it in the script itself. Most experienced system admins would opt for (1) with explicit exports for every variable needed. At least that way the script is self contained and you are not contaminating your startup files with stuff that is only used in a one off script. --- Mystic BBS v1.12 A46 2020/08/26 (Raspberry Pi/32) * Origin: Tribe BBS (21:1/177) .