Re: run bash <filename> from cron

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Mark Haney wrote:
> This might be a bit OT, but I've never had to do this before and what
> I've googled doesn't seem to be working.
>
> I have an ansible playbook that I'm working on that I want to run as a
> cronjob.  One task I'm having trouble with is where I have a text file
> with lines like:
>
> rd.pl "blah blah"
> rd.pl "blah blah blah"
>
> This text file has to be 'executed' using 'bash filename.txt'. (Don't
> ask why, I'm working on code that isn't mine.) When I run the playbook
> in a console this bit works perfectly.  However, when it's being run
> from cron, it dies with 'rd.pl: command not found'.  My original thought
> is that cron's $PATH is missing the location to this rd.pl file (it's in
> /root/bin), so one suggestion from the Google was to add the path into
> /etc/crontab, but I'm still having the same problem.  At this stage,
> I've no idea what to try next.  Any ideas?
>
> For the record, this was the only option to handle the task I'm having
> issues with inside cron.
>
Yes. Do not trust your environment, running as a cron job, to be what you
think it is. Try testing it by have your cron job, at the top of the
script, issue the env command.

       mark

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux