ok, i do that.
In system logs i see only:
Auto Cron

Moduł pobierania poczty wywołany [my-user-name]
Data dziennika/logów: czwartek, 15 lutego 2024 19:47 Adres IP: my-ip-adress

this show in logs when i login or refresh osticket panel.

in english:
Mail fetcher called [my-user-name]
Log date(s): Thursday, February 15, 2024 19:47 IP address: my-ip-address

    PawelPaciorek

    If you do not see an entry called "Cron Job" with the content "Cron job executed [CLI]" then your cron job is not running/working or not configured correctly.

    Cheers.

    could this be a peak permissions problem? Maybe after restoring a copy they are bad? Where can I check what permissions a file structure should have in osticket?

    my hosting provider's support says that cron is working and I should look for the problem in the cron file
    logs:
    Feb 16 12:26:01 22591 /USR/SBIN/CRON[39244]: (username) CMD (/usr/bin/php /home/users/username/domains/domain-name.pl/public_html/api/cron.php >> /home/users/username/domains/domain-name.pl/public_html 2>&1)
    Feb 16 12:26:01 22591 /USR/SBIN/CRON[39241]: (CRON) CRON_STAT (username:0:/usr/bin/php /home/users/username/domains/domain-name.pl/public_html/api/cron.php >> /home/users/username/domains/domain-name.pl/public_html 2>&1)

    My cron:

    • * * * * /usr/bin/php /home/users/username/domains/domain-name.pl/public_html/api/cron.php >> /home/users/username/domains/domain-name.pl/public_html/ 2>&1

      PawelPaciorek

      Confirm /usr/bin/php is the correct version of PHP. Also, you don’t need all that extra crap it can simply be:

      * * * * * /path/to/php /path/to/osticket/api/cron.php

      Cheers.

      PawelPaciorek

      All I can say is if you set your Default Log Level to DEBUG, run cron, and you don’t see a system log entry titled “Cron Job” then the cron is not correct or has an error somewhere.

      You should check all possible logs for any related errors. You should also try to run cron manually via CLI to see if it kicks back any errors.

      You also need to make sure the cron job is running as the web server/PHP user.

      Cheers.

      yes, /usr/bin/php is the correct vesion.
      before i backup files this working fine. i dont now what going on.

        PawelPaciorek

        Then you need to check all of your logs and run the command manually to see what's going on.

        Cheers.

        4 days later

        Hi, I added the following code to the file in cron.php in the api directory:
        <?php

        // Add correct path to your countlog.txt file.
        $path = 'hits.txt';

        // Opens countlog.txt to read the number of hits.
        $file = fopen( $path, 'r' );
        $count = fgets( $file, 1000 );
        fclose( $file );

        // Update the count.
        $count = abs( intval( $count ) ) + 1;

        // Output the updated count.
        echo "{$count} hits\n";

        // Opens countlog.txt to change new hit number.
        $file = fopen( $path, 'w' );
        fwrite( $file, $count );
        fclose( $file );
        ?>

        I also added the hits.txt file there
        The code itself works, I checked.(in the public_html directory)
        But when triggered by cron, should the counter in the hits.txt file be incremented, or will it not work?
        currently the counter in the hits.txt file does not change.

          PawelPaciorek

          Unfortunately, I'm not going to be able to assist with custom cron scripts.

          Are you sure you are calling the correct location/file? Have you tried running the cron command manually via CLI to see if any errors are being returned (eg. /path/to/php /path/to/osTicket/api/cron.php)?

          Cheers.

          When i run cron, i get this errors:
          Stack trace:
          #0 /home/users/user-name/public_html/domains/domain-name/public_html/main.inc.php(23): require()
          #1 /home/users/user-name/public_html/domains/domain-name/public_html/api/api.inc.php(23): require_once('/home/users/user-name...')
          #2 /home/users/user-name/public_html/domains/domain-name/public_html/api/cron.php(17): require('/home/users/user-name...')
          #3 {main}
          thrown in /home/users/user-name/public_html/domains/domain-name/public_html/bootstrap.php on line 344
          PHP Fatal error: Uncaught Error: Non-static method Misc::currentURL() cannot be called statically in /home/users/user-name/public_html/domains/domain-name/public_html/bootstrap.php:344

          My cron.php file
          <?php
          /*********************************************************************
          cron.php

          File to handle LOCAL cron job calls.
          
          Peter Rotich <peter@osticket.com>
          Copyright (c)  2006-2013 osTicket
          http://www.osticket.com
          
          Released under the GNU General Public License WITHOUT ANY WARRANTY.
          See LICENSE.TXT for details.
          
          vim: expandtab sw=4 ts=4 sts=4:

          **********************************************************************/
          @chdir(dirname(FILE).'/'); //Change dir.
          require('api.inc.php');

          if (!osTicket::is_cli())
          die(__('cron.php only supports local cron calls - use http -> api/tasks/cron'));

          require_once(INCLUDE_DIR.'api.cron.php');
          LocalCronApiController::call();
          ?>

            PawelPaciorek

            To me it seems like you are using an older version of osTicket or an unsupported version of PHP. What is your osTicket version and what is your PHP version?

            Cheers.

            Hello,
            PHP 5.4 [LEGACY]

            Apache
            Database client version: libmysql - mysqlnd 8.1.10

            PawelPaciorek

            Wow, that’s an extremely old version of PHP. I would highly suggest upgrading your PHP and osTicket and retest.

            Cheers.

            6 days later

            PawelPaciorek

            I’m sorry but without you being on a latest release with the latest supported prerequisites then I wouldn’t be able to assist you further.

            Cheers.