TurnKey Linux Virtual Appliance Library

cron jobs not running on TK appliance [solved]

I've been exploring the various TK appliances. While working with vTiger, I had to setup cron a job fro emails to be generated. I did so from webmin and all looks right. However, the cron did not seem to run. When I upgraded to the latest version of vTiger because I thought that the one in the TK appliance was too old and the newer version would probably work. After upgrading with a data migration, I experienced the same problem.

I recreated the cron and it still would not run. When running it manually, the software generates the emails as it should, which led me to realize that even though the cron job is set, it does not get launched.

Is there anything I need to do?

Cron was not configured properly

I used webmin to configure the cron jobs and did not relize that the "All" selection in all fields did not work. I changed to "Selected" and CTL+clicked every 5 mins. Works now.

Jeremy's picture

Glad you got it sorted

But something else for the record, is that often cron doesn't know the path to scripts you wish to run. Just because something runs from the commandline doesn't necessarily mean that cron will be able to find it. You can import your paths (ie the root user's) into cron, but I've never actually tried that, I just use the full path for scripts I wish to run.

CURL not working from CRON

I read what you said regarding scripts that run successfully from the command line, but not from cron. That seems to be my issue. I have a PHP script that I can run ok from the command line, but when I run it from cron I get an error.   I used to get the same error before I installed CURL and got it working from the command line by getting the CLI php.ini settings right... but now I am stumped as to why cron is giving me the error from the output command window.

Any ideas?  thanks!

Update.....

Actually I found out that I was wrong.... I can only run it from the directory that the PHP file is in from the command line. So it must be a path issue I guess...

Now Im not really sure where to look... I am attempting to get a script written using the Amazon MWS API to pull orders from Amazon.... the API uses several PHP files as includes and uses ".." as part of the path to find those files.

I will try modyfing the PHP files and putting in the direct path and see if it helps.

Update [solved]

Just found out I could issue two commands in one line with cron so I simply changed to the correct directory first and then put my script at the end like so: "cd /var/www/MyPath/ &&  php MyScript.php"

Its working now!  :)

Maybe this will help someone else in the future... Happy New Years everyone! 

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)