On my side, I am the only one who has a Flarum installation that does not work with cron jobs?

Thanks 😉

    I setup scheduler via cron but scheduled drafts do not work. System log says cronjob worked without problem but drafts still waiting in pool.

      askvortsov > No error about the cron job. Nevertheless, as said by @murdocklawless. If I go through the terminal of cPanel the command runs normally, it says that it has put online. However, not everything that is in draft is automatically published.

      I use next extenssions:

      • FoF Drafts
      • FoF Sitemap

      Thanks ^^

      a month later

      murdocklawless yes , I have the same problem. I have to manually use command php flarum schedule:run to post draft actually. Not sure if it's working on Popular Disccusion

        Teddan the problem was solved, update drafts extension. Also setup a cronjob for automatic publish.

        copy paste this to crontab

        * * * * * cd /<your flarum directory> && php flarum schedule:run >> /dev/null 2>&1

        6 months later

        Should I run this cron using sudo? because on my side if I run this command without sudo then I couldn't clear the cache using flarum but instead I need to clear cache using ssh every time; ps: I also run a queue using cron on the server

          lichengkun135 you need to run the command with sudo as the user the site runs as, eg www-data. This applies every time to run flarum commands.

            luceos
            I'm not sure if I get correctly what you mean😂, but if I try to run this scheduler with sudo then I get errors like:

            Could not open input file: flarum

            edit: I was dumb, using sudo before php solved the error, the way I used it was incorrect; but the cache clearing issue still exists

              5 months later

              IanM Hi Ianm, You might want to update the main post with this info, it might be helpful. For those using DirectAdmin, the cronjob is usually a bit different. This is the one I have configured and it works. You only have to change the user and domain in the path

              * * * * * cd /home/YOUR-USER/domains/YOUR-DOMAIN/public_html/; /usr/local/bin/php && php flarum schedule:run >/dev/null 2>&1

              Collecting the configurations of various systems (PLESK, CPanel, DirectAdmin...etc) could be useful and would certainly unload this thread of questions.

              Hi,
              What is cronjob command for shared hosting "cPanel"?

              15 days later

              Hello Guys,
              Here's how to setup the cron on Namecheap
              i used this on my Windev Forum WxDevs

              cd /home/libepval/wxdevs.com && /usr/local/bin/php flarum schedule:run

              and if your Flarum install is in the main directory use this

              cd /home/libepval/Public_Html && /usr/local/bin/php flarum schedule:run

              You must know that (libepval) is my cpanel Username.

              Good Luck

              25 days later

              I’m experimenting with cron jobs and cpanel, based on what I found in this thread, can someone help me? Which command have the correct formatting?

              cd /home/YOUR-USER/YOUR-DOMAIN; /usr/local/bin/php && php flarum schedule:run >/dev/null 2>&1

              cd /home/YOUR-USER/YOUR-DOMAIN && /usr/local/bin/php flarum schedule:run

              cd /home/YOUR-USER/YOUR-DOMAIN && php flarum schedule:run >> /dev/null 2>&1

                enricodx cd /home/YOUR-USER/YOUR-DOMAIN && /usr/local/bin/php flarum schedule:run works for me.

                14 days later

                luceos Also make sure it runs as the right user, seems to run as root now where it should run as the website user the website runs under www-data or something similar.

                luceos you need to run the command with sudo as the user the site runs as, eg www-data. This applies every time to run flarum commands.

                According to these, why am I editing the crontab for the current user, then? The command crontab -e in the OP implies that I am changing the crontab for the current user, and not for the www-data user (assuming the flarum install directory belongs to the www-data user and under /var/www/flarum directory).

                Should the crontab command be something like, sudo crontab -u www-data -e ?

                  mrXmr on many hostings, the default SSH user will be the correct one, so I assume that's why the command in the tutorial was simply given like this.

                  It seems like -u is indeed the correct option to modify another user's crontab. Or if your host support it you could switch shell user using the su command before calling ctrontab -e

                  12 days later
                  a month later

                  Hello,
                  Unfortunately, I still have a problem with running this schedule. I have an account on shared hosting, and I know that cron generally works.

                  An example of another task that works for me:

                  /usr/local/bin/php82 /home/MY_USERNAME/domains/MY_DOMAIN/public_html/bin/console cron:daily

                  In the case of Flarum, the path looks like this:
                  /home/MY_USERNAME/domains/MY_DOMAIN/public_html/flarum/

                  I have set up cron in the panel like this:

                  • * * * * /home/MY_USERNAME/domains/MY_DOMAIN/public_html/flarum/ && /usr/local/bin/php82 flarum schedule:run

                  Unfortunately, it doesn't work. I also tried:

                  • * * * * /home/MY_USERNAME/domains/MY_DOMAIN/public_html/ && /usr/local/bin/php82 flarum schedule:run

                  Still nothing... I also tried according to the description:

                  • * * * * cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/ && php flarum schedule:run >> /dev/null 2>&1
                    and
                  • * * * * cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/flarum && php flarum schedule:run >> /dev/null 2>&1

                  Unfortunately, without success... I have been struggling with this for two days now. Please help!