Clone this wiki locally
MPOS is using various cronjobs to do back end processing. This includes but is not limited to:
- Finding new blocks created by the pool
- Updating block confirmations in the pool
- Counting round boundaries
- Processing user round/share payouts and debit transactions (manual and automatic)
- Processing worker notifications
- Updating statistical data used by the frontend
- Cleanup of archived shares
- Other smaller tasks that needs to be handled by the backend
All crons have logging to console disabled. Instead, a logfile is created for each cron under the
cronjobs/logs directory in MPOS. If you are having issues with crons (you can see their status on the Admin Panel -> Monitoring page) this is the best place to check for additional information. If you wish to enabled debug mode, modify
shared.inc.php and replace
KLogger::DEBUG. Ensure to disable this option again when you are done, logfile will grow rather large with it enabled!
A logrotate example file is included in the repository at
cronjobs/etc/logrotate.conf and can be triggered with the
cronjobs/logrotate.sh script. It will cycle the files at a daily interval keeping up to 7 days as an archive.
A brief description of all the cronjobs included in this project, sorted alphabetically.
Scans the shares_archive table for old shares that can be deleted according to the configuration. You can modify the cleanup behavior in the global config.
Runs all scheduled payouts setup or initiated by users. Each user will be processed independently so even if a user has setup a wrong LTC address (even though MPOS will try to ensure it's valid), other users are not affected by that. Disabling this payout via Admin Panel will allow for some maintenance work without payouts being processed.
Checks our RPC service for updated confirmation records for our found blocks and transfers them to the DB. Without this, no transactions would be confirmed and converted to confirmed credits.
As the name suggest, it will look into the RPC service for newly found blocks and add them to the database. Once all blocks are found, it will check each blocks upstream accepted share and calculate the round shares. No further processing is done, but this information will be used by the payout crons later.
As the name suggestes, notifications related to backend jobs like IDLE workers will be sent with this cronjob. It will also ensure that notifications are reset once a worker becomes active again so new notifications can be send out. You can globally disable notifications but each user also has the ability to setup their notifications. Globally disabled notifications override all user setting.
pplns_payout.php & proportional_payout.php & pps_payout.php
These crons, depending on which one is enabled in the global configuration, will handle payouts to users. PPLNS and Prop both are round based while PPS will payout per share. Round ends are still processed for statistical purposes. Only unaccounted new blocks with a valid share ID will be processed!
Updates various cache keys in memcache to allow the frontend to respond fast to requests. Most notably it is checking for all users shares and increments them each run so this information is available to the frontend without checking the database.
Runs API calls against external sites. Since we can't cross-call APIs due to XSS protection in browsers, this cron will check them instead. Results are added to the database and made available to the frontend.
Runs a few maintenance tasks to keep your tables clear.
Instead of running a single cronjob manually it is recommended to use a split automatic setup to ensure some crons are always running at set intervals, specifically our
statistics.php. For long rounds or coins with a lot of shares, it is a requirement to run the statistics cron as often as possible to ensure a responsive site after a round ends.
This cron will ONLY update the statistics cache. You can add it to your crontab at a minutely interval.
Manages the round ends, finding blocks and everything related to internal and external payouts. Can run as often as you need, for PPS pools it is recommend once per 30 minutes to one hour. This keeps the amount of transactions created as low as possible, enabling faster payout for users.
Clears up your tables, sends IDLE worker notifications and updates the coin price and uptime robot status. Can be run as often as needed, but once every minute should be fine.
This is a sample configuration for a pool. It will disable mailing events through cron and ensure that we are not running into cron-conflicts between multiple MPOS instances by adding the subfolder parameter
-d. Other coins can be called the same way by adding other subfolders where to store the PID files (usually
/tmp/<FOLDER>/*.pid). To make your own MPOS configuration run your crontab by calling
crontab -e and pasting the cronjob data you create generateit.net and crontab-generator.org at the end of the created file. Once your file is created and saved, you can view your crontab by calling it with the
crontab -l command.
MAILTO="" * * * * * /var/www/MPOS/cronjobs/run-statistics.sh -d LTC * * * * * /var/www/MPOS/cronjobs/run-payout.sh -d LTC * * * * * /var/www/MPOS/cronjobs/run-maintenance.sh -d LTC