Also you are running as root.
Ubuntu last I checked used the user www-data for Apache and web.

You do not need to use an API key if you are running locally. API keys are used for remote cron.

    You are right ntozier it used www-datafor apache and web. how should i run it.
    Grizly Exactly what should i do sir. Please tell . I was just waiting for someones reply. I am new for this kind of process. I will be thank full it you guide me step by step that how i should do all this to run my externel task scheduler.

    I must admit across every Linux system I've used I have never once seen a cron setup outside of osTicket where the username is specified after the schedule. I've always used the command directly after the schedule with the job set in the desired user's crontab (even the commented out text in the screenshot above suggests this).

    crontab -u www-data -e while logged in as your admin account would set the cron to run as www-data in this way, but as I've already posted my setup in an earlier thread I'll keep the semantics out of this one 😇

      hello @RBGE
      So i dont need a externel script to fetch my emails. I made a python script for it.

      I have made changes in crontab using following users

      1. Login as root>crontab -e > /5 * * * /usr/bin/php -q /var/www/html/osticket/api/cron.php>:wq>reload cron
      2. Login as local user(amar)>crontab -e > /5 * * * /usr/bin/php -q /var/www/html/osticket/api/cron.php>:wq>reload cron.
      3. Login as root>crontab -u www-data -e > /5 * * * /usr/bin/php -q /var/www/html/osticket/api/cron.php>:wq>reload cron.
        Exactly what should i use in the above users. Thanks. I am sharing some screen shots that cron is executing.
      • RBGE replied to this.

        You do not need an external script if you are running cron locally.

        You would run the cron task as www-data.

          thanks ntozier RBGE @Grizly . Next i need help in setting up remote cron . And how i can make all the tickets generated time from UTC to IST.

          If your running cron locally... why would you need to setup remove cron? That sounds like a recipe for collision to me.

          Your timezone can and should be be set in multiple locations:
          php.ini
          mysql server
          osTicket: Admin panel -> Settings -> System: Default Time Zone.
          osTicket Agent profile: Agent panel -> Profile -> Preferences -> Localization.

          amarnath You have three separate cron jobs all doing the same thing. While it won't really cause any serious problems, it's not exactly efficient. I think you'll get separate suggestions from everyone here as to the best way of doing things, but mine would be to get rid of all the existing cron setups and start again with just number 3.

          As ntozier mentioned, the timezone does need to be set in multiple places. For PHP, go into php.ini and look for the line starting date.timezone making sure it's not commented out, then set it to the relevant value according to this page: https://www.php.net/manual/en/timezones.php - you'll also need to ensure the server itself is running on the correct timezone.

          Iwant to change the time zone as high lighted in the screen shot.

          • RBGE replied to this.

            amarnath Okay, I can see that PHP is currently set to Asia/Kolkata, so you'd want to go to your php.ini file, find the date.timezone line and change it to

            date.timezone = "Asia/Jerusalem"

            Obviously the exact length of php.ini can vary, but on mine it's on line 972. Remember to restart your web server after this change.

            i want to change time zone Asia/Jerusalem to Asia/kolkata. Were i can do this changes.

            • RBGE replied to this.

              See the below screen shot i want the tickets timing should be as Asia/Kolkata timezone format.See my system time and the ticket generated time. Now its diffrent.

              amarnath Ah, okay then. MySQL (and MariaDB) by default will pick up the time from the system - is this set correctly? You can run sudo dpkg-reconfigure tzdata to verify this, making sure to restart MySQL afterwards if anything changes. If you need to somehow set the timezone manually in MySQL, have a look at https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html as there are a few ways of doing so, and if the timezone has already been manually set, it'll need changed back.

              Setting the layout in osTicket is done via Admin -> Settings -> System in the 'Date and time options' section. Make sure the timezone is set properly and locale is set to default (or change it manually if locale is somehow wrong). It's also worth checking your profile to make sure you're not over-riding the default value.

              +--------------------+---------------------+
              | @@global.time_zone | @@session.time_zone |
              +--------------------+---------------------+
              | SYSTEM | SYSTEM |
              +--------------------+---------------------+

              • RBGE replied to this.

                amarnath Perfect! That's as it should be. Just need to set the system default timezone using dpkg-reconfigure 🙂

                  so from now onward the tickets get generated will show me in IST time. Right. But still it shows Asia/Jerusalem. I want to change it to Asia/ Kolkata.

                  Below are the screenshots that i have made to Asia/Kolkata for admin as well as agent.

                  • RBGE replied to this.

                    RBGE the cron is taking around 10min max to generate a ticket.
                    this is my cron command- */5 * * * * /usr/bin/php -q /var/www/html/osticket/api/cron.php

                    What is the issue. exactly. I want the tickets to be generated in 1-2minutes. What should i do.

                    • RBGE replied to this.