Setup the Flarum scheduler using cron
Mirzaagha your command is wrong, clark showed you here clarkwinkelmann the command you need to use.
cd /home/codestac/public_html && /usr/local/bin/php flarum schedule:run > /dev/null
The path /home/codestac/public_html
assumes your flarum file is located in there. Mine isn't setup quite the same way, so just make sure you are not exposing your config.php
or any other sensitive configurations in public_html
.
ctml okey, how to find my flarum folder? my vendor? public folders at in the home/codestac/public_html
I am not able to get my scheduler working as per the following screenshot:
My cronjob is configured to the following format:
cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/discussions && /usr/bin/php flarum schedule:run >> /dev/null 2>&1
Can anyone help me troubleshoot this as to why scheduler is not working?
whisperwow can you verify that you are targeting the command in the right directory? Did you try running the command manually (not in a cron) to verify it works?
whisperwow try executing this command without dev null manually and see if you encounter any errors:
cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/discussions && /usr/bin/php flarum schedule:run
- Edited
luceos I was successfully able to execute the above command (with my username and domain of course) directly from the SSH Command line. However, the cron job still does not work.
- Edited
whisperwow as what user are you executing the command? In your panel.
luceos Not sure I understand your question. When I log into the SSH command line through my Terminal program, I login with the SSH password. No user is specified. When I am in my Hostinger Hpanel, I am logged in as an admin setting up the cronjob. I am the only user on the account.
whisperwow the question relates to the cronjob you set up
whisperwow My cronjob is configured to the following format:
cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/discussions && /usr/bin/php flarum schedule:run >> /dev/null 2>&1
Where exactly is that set up, did you use crontab on the server? If so, as what user?
- Edited
luceos I am using the cronjob feature of my Hostinger hosting account. Following is my cronjob with the username displayed:
cd /home/MY_USERNAME/domains/MY_DOMAIN/public_html/discussions && php flarum schedule:run
Does that help?
whisperwow i dont see a thing wrong with it. So you might best ask hostinger support about this.
luceos OK thanks for the replies. I'll check again with Hostinger support.
- Edited
whisperwow I'm a bit confused, because that is not the syntax for a crontab.
The cron job syntax looks like this:
https://en.wikipedia.org/wiki/Cron#Overview
I guess you are using some GUI I'm not familiar with:
https://support.hostinger.com/en/articles/1583465-how-to-set-up-a-cron-job-at-hostinger
Could you provide a screenshot, just for the sake of clarity?
Also, don't you have any shell access? If so, can you do "crontab -l" to show your current crontab and "crontab -e" to edit it?
whisperwow having been responsible over an inhouse developed control panel for over 7 years, I can only be astonished about how user unfriendly this is. But glad you figured it out.
BeeMeme I suggest you reach out to your hosting provider directly. Perhaps if you share some details on where your community is hosted, we can help you better.
I've set the cronjob correctly to run every minute, I have the FoF sitemap extension enabled and set to rebuild hourly but on the dashboard I still see "Scheduler - Inactive". It seems to be running, I see the updates in the sitemap.xml. What is wrong?
- Edited
whisperwow Sorry to bother you, but could you help me on that ? It doesn't seem to do anything.
Did you write /usr/bin/php
in before the flarum schedule ?
I have this as the bash script :
#!/bin/sh
cd /home/u123456789/domains/example.com/public_html/forum/ && /usr/bin/php flarum schedule:run >> /dev/null 2>&1
It doesn't seem to do anything. I also have that :
https://ibb.co/Ks2JLjv
It somehow works on my Rapsberry Pi or in any Linux machine. But not on Hostinger. I will presumably self host at some extent.