Menu

Initial cronjob setup for extensions

2024-01-23
2024-01-23
  • Igor Svetek

    Igor Svetek - 2024-01-23

    I seem to have problem setting up cronjob for background processes.
    I have installed AutoCloseTicket extension, and it was successful (it is on the list of installed extensions). I did not change OOTB setting, so ticket should after 7 days in Resolved status change to Closed. But not a single ticker changed it status.

    In priv_background table (SQL) I see AutoCloseTicket entry, but it is never run (next_run_date has not changed from the installation date). Also, all other entries did not run since installation (next_run_date has not changed from the installation date).

    I created entry in scheduler with command from documentation (iTop is running on Ubuntu Server):
    */1 * * * * www-data /usr/bin/php /var/www/html/itop/webservices/cron.php --param_file=/etc/itop-cron.params >>/var/log/itop-cron.log 2>&1

    - www-data is user which is running web server (apache2).
    - /usr/bin/php is actualy pointing to /usr/bin/php7.4 (I do not believe that this could be the issue)
    - param_file exists and the path to it is correct
    - itop-cron.log exists and all entries are as follows: "/bin/sh: 1: www-data: not found"

    Any help would be much appreciated!

    Also, auth_user and auth_pwd parameters inside itop-cron.params, should this be Ubuntu or iTop account? I presume it should have admin rights.

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-01-23

    Seems like your shell is interpreting www-data as a command rather than as a user? Try leaving it out?

     
    • Igor Svetek

      Igor Svetek - 2024-01-23

      When I delete www-data from cronjob, now I get:
      PHP Fatal error: Uncaught ConfigException: Could not read configuration file (the file exists but cannot be read). Do you have the rights to access this file?: file = /var/www/html/itop/conf/production/config-itop.php in /var/www/html/itop/core/config.class.inc.php:1945
      Stack trace:
      /var/www/html/itop/core/config.class.inc.php(1958): Config->CheckFile()
      /var/www/html/itop/core/config.class.inc.php(1911): Config->Load()
      /var/www/html/itop/application/utils.inc.php(962): Config->__construct()
      /var/www/html/itop/core/log.class.inc.php(948): utils::GetConfig()
      /var/www/html/itop/core/log.class.inc.php(839): LogAPI::GetConfig()
      /var/www/html/itop/core/log.class.inc.php(827): LogAPI::GetLogConfig()
      /var/www/html/itop/core/log.class.inc.php(783): LogAPI::GetMinLogLevel()
      /var/www/html/itop/core/log.class.inc.php(761): LogAPI::IsLogLevelEnabled()
      /var/www/html/itop/core/log.class.inc.php(746): LogAPI::WriteLog()
      /var/www/html/itop/core/log.class.inc.php(703): LogAPI::Log()
      /var/www/html/itop/applicat in /var/www/html/itop/core/config.class.inc.php on line 1945

      I checked config-itop.php file, permisions are 440.

       
      • Jeffrey Bostoen

        Jeffrey Bostoen - 2024-01-23

        Check out the owner of that file. See if you can schedule a cron job as the owner of this file (could be www-data).

         

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.