MyBB Community Forums

Full Version: Task Manager
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible for the task scheduler to execute the script without the forums being in use? Rather than someone have to constantly use the forum for the scripts to run on time?
not sure that is possible. as you might be knowing, you have to use cron jobs at server level for such tasks.
So would I have to create my own code to allow this to happen, I am running a plugin that allows forum groups to be synced with teamspeak 3 server groups and I want the script to run every 5 minutes regardless of server action
^ if you are comfortable in coding then better to make it yourself. or you may post request with details at R/S/J section
Make sure that task.php from the main directory is being executed. See examples for cron and systemd timers, respectively: https://docs.mybb.com/1.8/administration/task-manager/, https://community.mybb.com/thread-211078...76530.html
I set up a cron job to hit task.php every few minutes.
It does not seem to work if I try to make a cron to run task.php

I have also tried to setup a different cron that will run teamspeak3.php (one of my scripts in my task manager) but that does not work either
(06-29-2017, 07:12 PM)HCStrike Wrote: [ -> ]It does not seem to work if I try to make a cron to run task.php

I have also tried to setup a different cron that will run teamspeak3.php (one of my scripts in my task manager) but that does not work either

Your cron job needs to call it as a URL (eg. with wget or curl) instead of acting like task.php is a local PHP file.

Here's my /etc/crontab entry:
*/2 * * * * myself wget -O /dev/null http://www.mydomain.com/forums/task.php > /dev/null 2>&1

Replace myself with your username and verify the URL to your forums.
(06-29-2017, 02:43 PM).m. Wrote: [ -> ]not sure that is possible. as you might be knowing, you have to use cron jobs at server level for such tasks.

(06-29-2017, 10:11 PM)laie_techie Wrote: [ -> ]
(06-29-2017, 07:12 PM)HCStrike Wrote: [ -> ]It does not seem to work if I try to make a cron to run task.php

I have also tried to setup a different cron that will run teamspeak3.php (one of my scripts in my task manager) but that does not work either

Your cron job needs to call it as a URL (eg. with wget or curl) instead of acting like task.php is a local PHP file.

Here's my /etc/crontab entry:
*/2 * * * * myself wget -O /dev/null http://www.mydomain.com/forums/task.php > /dev/null 2>&1

Replace myself with your username and verify the URL to your forums.

Thanks for the help, if I have a php file in my /inc/plugins/ directory, how can I setup cron for that?
(06-29-2017, 10:26 PM)HCStrike Wrote: [ -> ]Thanks for the help, if I have a php file in my /inc/plugins/ directory, how can I setup cron for that?

Is it a plugin? Plugins have a different structure than other PHP files. When you directly access a PHP file in a browser, it executes code that is outside any method or class. All code within a plugin should be in appropriately named methods (such as plugin_info or plugin_run).

If it's not a plugin, it should be in a different folder.

*/2 * * * * myself wget -O /dev/null http://www.mydomain.com/forums/task.php > /dev/null 2>&1

Look at this cron job definition.

*/2 * * * * means to run every other minute of every day of every month regardless of day of week.

myself is the user this cron job should run as. You could run as root, but probably not a good idea.

wget is used to fetch a web resource
=O /dev/null means to save that resource to nowhere
http://www.mydomain.com/forums/task.php is the URL of the resource. You need to change the domain name and possibly the directory of your forums. Many people are also moving to https instead of http.
> /dev/null 2>&1 means to ignore STDOUT (standard out) and STDERR (standard error)

For further help, I would need your forum URL.