Skip to content

Cronjob

Mark Friedrich edited this page Jul 20, 2018 · 8 revisions

PATHFINDER requires some static data (e.g. system jumps/kills). This data should automatically be imported by a cronjob..

You have to set up a cronjob in order to import some data, and run some DB-cleaning tasks. The setup is pretty easy and requires SSH access to your server. If you are not familiar with crontab on Unix systems, → read more: guide.

You have to setup a single cronjob for this, that handles all other cronjobs (like a "dispatcher").

Hint:

  • If the cronjob (/cron) times out, its usually OK. The Data will be continue to import in the background (async).
  • If your cronjob is set up properly, it will take up to 1h until the first data import starts.

Setup the Pathfinder cronjob

Option A - [preferred]

If you have SSH access to your server, the best way to do this is by using crontab command for this.

  • $ crontab -e will show your current crontab file. Each row represents a cronjob. If you haven´t set up any cronjob bevore, it is probably empty ;)
  • Add the following line to this file. Don´t forget to replace the project path and 'nginx' user name!
* * * * * cd /var/www/pathfinder.com/public_html; sudo -u nginx php index.php /cron >> /var/log/cron-www/pathfinder.log 2>&1

Hint: The log file path at the end is optional. This will log any output (e.g. errors) to a *.log file.

Important: Block user access to [YOUR_DOMAIN]/cron (e.g. by a .htaccess file). Crontab will trigger index.php bei CLI. If you don´t want to use .htaccess files (e.g. using Nginx server), you could alternatively edit cron.ini end set "web" access to "false.

Option B - [3rd party]

If you don´t have the option to configure cronjobs for your webspace (e.g. shared web hoster), you can use a "3rd party" cronjob service for this. There are a lot services available e.g. easycron.com.


Custom cronjobs [optional]

If you want to add additional cronjobs for Pathfinder please read:

Cronjobs in PATHFINDER are handled by xfra35/f3-cron, which is 3rd party extension for Fat Free Framework. If you are planing to add/edit custome cronjobs, you probably want to check out the documentation.

You don´t have to care about the configuration for each job, this is already done in cron.ini. you could add your custom cronjob at the end.