Re: [webmin-l] Odd problems with cron jobs

"Jamie Cameron" <[email protected]>
Newsgroups gmane.comp.web.webmin.general
Message-ID <[email protected]>
On 07/Nov/2016 02:14 Joaquim Homrighausen <[email protected]> wrote ..
> I have a few cron jobs that send out reminders for the Redmine application.
> 
> They are executed on different servers with somewhat different 
> configuration, but two of the mysteriously fail when executed via cron, 
> but not when I re-do them on the command-line (exactly as the cron job 
> is defined) or when I choose to run the job from Webmin.
> 
> The first one runs a shell script that contains:
> 
> #!/bin/bash
> cd /usr/local/share/redmine
> /usr/local/bin/bundle exec rake redmine:send_reminders days=14 
> RAILS_ENV="production"
> 
> This one results in a message like this (sent via e-mail to me):
> 
> [31mbundler: command not found: rake
> Install missing gem executables with `bundle install`
> 
> If I either run the shell script from the command-line, or manually 
> enter the commands contained therein, or execute the shell script from 
> Webmin, there are no error messages.
> 
> 
> The second one looks like this when defined in cron:
> 
> cd /usr/share/redmine-3.3.0; /usr/local/bin/bundle exec rake 
> redmine:send_reminders days=14 RAILS_ENV="production"
> 
> It generates an error that looks like this:
> 
> bundler: command not found: rake
> Install missing gem executables with `bundle install`
> 
> 
> But once again, if I either copy and paste all of that, it runs without 
> a hitch. If I do the commands separately on the command-line, it works. 
> If I run the job from Webmin, it works.

Sounds like a PATH problem. At the top of the script, try adding
a line like :

PATH=${PATH}:/usr/local/bin

(assuming that the rake command is in /usr/local/bin)


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
-
Forwarded by the Webmin mailing list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.