TurnKey Linux Virtual Appliance Library

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?

No one got an idea?


Jeremy's picture

No sorry

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.

Cronjob - Not working / Strange behavior

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...

same here

same problem here.

I solved it this way

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

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's picture

Can also just use full path for scripts to run

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

Eric (tssgery)'s picture

What I normally do is

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.


solved

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

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)