Menu

Urgent: Cron.php is not working in Ubuntu CLI

arvindg
2011-07-29
2014-09-17
  • arvindg

    arvindg - 2011-07-29

    Dear All,

    I have one issue in TTR/TTO notifications. I schedule cron.php  but it is not working. I am using Ubuntu CLI.
    but in Ubuntu GUI same this is working fine.

    Please help me out.

    Regards
    Arvind

     
  • Denis

    Denis - 2011-07-29

    Hi Arvind,

    Could you be more specific about what is not working ? What is the symptom ?

     
  • arvindg

    arvindg - 2011-07-29

    HI Dflaven,

    I install itop on ubuntu cli 10.04. everything is working fine. but TTR/TTO notification is not working.
    Firstly i run this cmd:- php -q /var/www/web/webservices/cron.php -auth_user=admin -auth_pwd=athenta
    But no output.

    After that i schedule the cron.php via crontab
    * * * * * /usr/bin/php /var/www/web/webservices/cron.php -param_file=/var/www/web/webservices/cron.params
    It run only first time.
    But after that it is not working.

    Note:- our time zone is Africa/Nairobi
    Regards
    Arvind

     
  • arvindg

    arvindg - 2011-07-29

    one more thing..

    Status is not changing  to escalated tto/ttr that's why there is no TTR/TTO notification.
    e.g. I create 1 ticket and there is 15 min escalation time to TTO. but after 15 min status still the same.

     
  • Denis

    Denis - 2011-07-29

    No output: it's normal, by default the script is "silent", try to launch it with the -verbose option to get more information.

     
  • arvindg

    arvindg - 2011-07-29

    command output….

    root@ubuntu# php -q /var/www/web/webservices/cron.php -auth_user=admin -auth_pwd=athenta -verbose
    Starting: 1311928147
    Already running…
    Exiting: 1311928148

     
  • TheBigOne

    TheBigOne - 2012-08-31

    Just in case someone is interested.
    cron.php is locking the db during cron.php run.

    SELECT IS_FREE_LOCK("itop.cron.php");

    I tried SELECT RELEASE_LOCK("itop.cron.php"); without success.
    Restarting the DB fixed the problem of the output "Already running…"

    But as already mentioned, this is fixing the problem just for the first run of cron.php.

    I`m not sure whats wrong here.

    Any hints?

     
  • Denis

    Denis - 2012-08-31

    @johndoe,

    The query SELECT IS_FREE_LOCK('itop.cron.php') is used to make sure that there is just one instance of cron.php running at a given point of time. The process is then supposed to release the lock before dying using the query SELECT RELEASE_LOCK('itop.cron.php').

    The idea is that cron.php is allowed to run for a given period of time (cron_max_execution_time in the config) and will be respawned after that time to cleanup PHP's memory leaks. During that period cron may try to create other instances of cron.php. Such instances will terminate immediately saying "Another instance is already running…". So depending on the value of "cron_max_execution_time" and the interval you set for the cron to run, it's normal to see a number of "Another instance is already running" in the output/log of the cron. Finally the new process will take over after first instance of cron.php has terminated its job properly.

    It's definitely not easy to implement a robust and portable mutex mechanism in PHP… if anyone has a better idea, just let me know.

    - Denis

     
  • israel

    israel - 2014-09-17

    use php-cli command instead php -q or php

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.