Getting osTicket to schedule ticket creation from emails

If you go to Admin Panel > Emails > Settings > Incoming Emails, right now (as of release 1.10.4—the latest stable release as of this writing), you’ll see something called Fetch on auto-cron, which isn’t super useful, because it will fetch emails only if an agent is logged into osTicket.

There is an external scheduler option. Unfortunately (again, as of 1.10.4), that Using External Task Scheduler link is broken. I believe it’s supposed to go to RECURRING TASKS SCHEDULER (CRON JOB).

There, you see on a *nix system, you’re supposed to put in a cron job of

*/5 * * * * nobody /path/to/php /path/to/api/cron.php

but that didn’t work for me on Ubuntu 16.04.5 (Xenial). If I ran the command

sudo /path/to/php /path/to/api/cron.php

manually, it would fetch the emails and create a ticket. And, even when a ticket wasn’t automatically created, I could still see in /var/log/syslog the cron job actually having been run.

I even tried changing the user to root instead of nobody (but if you create a cron job using

sudo crontab -e

it runs as root anyway… not really sure what nobody is supposed to do there.

It didn’t work until I substituted in this line instead:

5 * * * * /usr/bin/php /path/to/api/cron.php

Now, again, I don’t really know what that nobody was supposed to do. According to the Ubuntu community docs, having the username in there is supposed to run it as that user, but when I had nobody or even root as the specified user, the command would run, but no ticket would be created.

I had to leave out the user altogether. Also, again according to the Ubuntu community docs, you should be able to put an */# in front of the four asterisks to run it every # minutes, but I found the command executed properly if I just put a single number in there.

Any cron job experts out there who can explain this, I’d love to learn more of the nuances of how this all works (or doesn’t work)?


Posted

in

by

Comments

2 responses to “Getting osTicket to schedule ticket creation from emails”

  1. Tim Avatar
    Tim

    This is exactly what I need to solve osTicket/cron issue in php 7 environment. Thanks!

  2. Gregg Avatar
    Gregg

    Thanks for the article.
    There is a tutorial at https://www.easycron.com/cron-job-tutorials/how-to-set-up-cron-job-for-osticket, may be help you set cron job.

Leave a Reply

Your email address will not be published. Required fields are marked *