osTicket version 1.14.1, PHP 7.0.33
First of all, thanks for all the help with my previous questions - very fast response time. ntozier, you need a raise.

So, I'm a Linux newbie - stupid questions incoming.

We're running osTicket on a local server. I'm trying to set up the auto fetch/ticket creation cronjob. I've generated the API key and stuck it in the rcron.php file, as well as editing the URL. I've also configured the corresponding email account in Emails -> Emails. What's the next step?
I read that other folks used services like easycron to set up the job, but I'd rather not use a 3rd party service if it's something easy to set up myself.

Random side-note: I noticed a grammar mistake on the main osTicket landing page - lower right corner has "osTicket comes pack with tons of awesome features you have to try out yourself." This should be 'osTicket comes packED with..."
Anyway, thanks for the help.

    qianhe If you're just running a cron job on a local server, you don't need an API key. First off, I'll assume you've got your mail details all set up correctly to pull tickets in from your mailbox. You need the username your web server runs as, usually www-data or apache .

    SSH into your server and type the following (note you need to be using an account with sudo access)

    sudo crontab -e -u www-data

    (replace www-data in the example above with the username your web server runs as)

    In the text editor that comes up, enter the following:

    */2 * * * * php /var/www/html/api/cron.php > /dev/null 2>&1

    Then save and exit, and in osTicket Admin -> Emails -> Settings ensure Email fetching is enabled, but fetch on auto-cron is not.

    This will poll your mailbox every 2 minutes (change the /2 to another number if you want to change this) and the > /dev/null 2>&1 part at the end ensures you don't get an email every time the cron job runs.

    Thanks, guys. I have the ticket creation working but now I'm having trouble creating a job that fetches emails and moves them to a specified folder.
    I have all the settings in the Admin -> Emails section correct.
    I read through the 2nd link ntozier posted above and set up this crontab to fetch/move every 10 minutes:
    */10 * * * * php /var/www/html/website/include/cli/modules/cron.php > /dev/null 2>&1

    Is that correct?

    Thanks in advance.

    You would want to change "php" to the "/the/path/to/php" otherwise it looks fine.

    I think I must have missed a step somewhere. I changed the crontab to:

    */10 * * * * usr/bin/php /var/www/html/website/include/cli/modules/cron.php > /dev/null 2>&1

    but still nothing is happening. I tried to run the cron.php file manually:
    /usr/bin/php /var/www/html/website/include/cli/modules/cron.php

    and I got: PHP Fatal error: Class 'Module' not found in /var/www/html/website/include/cli/modules/cron.php

    Shouldn't that read

    */10 * * * * /usr/bin/php /var/www/html/website/api/cron.php

    Good day
    please help i am getting duplicate tickets at the back-end of the system

    @Martin123 please do not hijack someone elses thread which is completely unrelated to whatever your issue is.

    Hokay, so it's still not working. This is what I've got in /etc/crontab.

    /support/api/cron.php works to create tickets (yay)
    /support/include/cli/modules/cron.php does not create tickets.

    Neither of them fetch/move the emails.

    Here's my crontab and email settings:


      Your webserver runs as nobody?

      Thanks for the reply.
      When I run ps aux | egrep '(apache|httpd)' I see processes running as 'root' and 'apache'. When I try to run the cronjob as either of those users it also doesn't move the emails.

      Also - I'm not sure if this is helpful or not - when I check the logs on our mail server the fetch requests aren't hitting it at all.

      qianhe /support/include/cli/modules/cron.php does not create tickets.

      ^ I'm not sure why you are trying to use this.
      You should be using /support/api/cron.php

      The cron job needs to run as a user that has access to the files. In your case that appears to be 'apache'.

      OK, at the risk of being redundant, let me make sure I understand.
      Does creating tickets and then moving the emails happen with 1 job or do I need 2?

      */5 * * * * apache /usr/bin/php /var/www/html/support/api/cron.php creates the tickets, but doesn't move the emails.

        qianhe
        you just need one script job, once the ticket created, it moves to Folder name you created

        Side thought... Did you create the folder osTicket2 in the mail box?

        I did. Good catch, though.

        OK, mystery solved. While fixing another problem with the system I installed a few of the critical extensions and set the timezone. Somewhere in there the problem fixed itself. You can close this thread.

        Thanks for all the help!

        Very welcome. I'll mark this as resolved and close it.
        Please feel free to start a new thread if you have another issue. 🙂