Hi, some time ago by accident I started deleting files from the ftp folder where I have osticket installed. Luckily, I had an up-to-date backup, so I restored the files. The system works but does not send new requests to email, so that the system stops new orders by email I have to log in to the panel. After logging in to the panel, the system sends to the e-mail all the requests that have been received since the last login. How do I fix this problem? Sorry for my English...

    And, when i try log in to osticket like support account, i see System Offline.
    I must change suport account to administrator, and then i can login to osticket.

      yes, I did that and it worked. But previously you could log in using the offline helpdesk setting.
      And it still sends jobs only after logging in, even though cron is set.

        PawelPaciorek

        Then it sounds like the cron isn't working or isn't correct. Set your Admin Panel > Settings > System > Default Log Level to DEBUG, Save Changes, let cron run, and check your Admin Panel > Dashboard > System Logs. You should see an entry titled "Cron Job" with the content of something like "cron job executed". If not then you know the cron is not running/working or is not correct.

        Cheers.

        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