[CentOS] run bash <filename> from cron

Wed Nov 15 18:25:37 UTC 2017
Mark Haney <mark.haney at neonova.net>

On 11/15/2017 11:57 AM, Paul Heinlein wrote:
> In your crontab, try
>   env PATH="$PATH:/root/bin" bash filename.txt
Maybe I wasn't terribly clear, for which I apologize.  I'm not running 
the text file itself from cron.  I'm running an ansible playbook from 
cron, which, as one of its tasks runs 'bash filename.txt'.  It's 
possible I could try the command you recommend above in the task and see 
if that fixes it.

However, I have another method that works in a similar fashion. I simply 
added BASH_ENV=$HOME/bash_profile to the top of my crontab, which has 
fixed the issue.  I could have sourced the profile on the cronjob line, 
but this is a bit clearer for other who might access the system.

Mark Haney
Network Engineer at NeoNova
919-460-3330 option 1
mark.haney at neonova.net