Cronjob - Not working / Strange behavior

cornelome's picture
First, please excuse my english. It's been some years since I "used" it. I'm a complete noob if things tangents linux. Let my describe the problem situation: I use a redmine appliance (V11) within our company. In this appliance I integrated an so called "whining" addon which should send an email, if tickets are pending for quite some time. In the prior redmine appliance (V10) this worked without problems. Now it seems like cron never starts the job - no matter what periods of time I set. I also changed the user from www-data to root - but this also didn't brought a solution. If I start the cronjob by myself (logged in as root) it works like it should. Please tell me what informations else you need to assess/gather the problem. Thank you very much! :) Leon
cornelome's picture

No one got an idea?


Jeremy Davis's picture

I have not set up any custom cron jobs and the default TKL ones seem to work fine so I have no idea. It may be worth searching and/or posting on the Ubuntu forums as TKL v11.x is based on Ubuntu Server 10.04.

adepier's picture

I have the same probleme, anyone has the solution? it works fine when started manually, but output: /var/www/recieve_mail_bash.sh: 6: rake: not found when started automaticaly...

KammutierSpule's picture

same problem here.

KammutierSpule's picture

I did a script.sh

and just run the command

sh scriptPath/script.sh

in script.sh, the rake command need to run with: "/usr/local/bin/rake" ... or whatever the path is..

Eric (tssgery)'s picture

It looks like cron is not setting up the same environment as you have when logged in as root. The error " /var/www/recieve_mail_bash.sh: 6: rake: not found" is saying that the 'rake' program is not in your path.

This is how cron works. If you want a profile setup, you'll need to do so from cron or the script itself.


Jeremy Davis's picture

I acidentally just found that out while working on something else! :)

Eric (tssgery)'s picture

What I normally do is to source my .profile or /etc/profile in my script to ensure I have the same environment for my cron jobs as my interactive shell.


adepier's picture

pb solved adding this lines in my recieve_mail_bash.sh file

HOME=/usr/local/bin/rake
PATH=/usr/local/bin:/usr/bin:/bin
source ~/.bashrc

Post new comment