Skip to content

Scheduler (cron) ​

Deposits, wallet balances, staking rewards, funding fees, mini-charts and the process watchers all run on a timer. They're defined in one place, app/Console/Kernel.php, and started by a single cron entry.

5 minutesServer administrationDevOpsVerified against the platform code

The cron entry ​

Add this line to the crontab of the web server user, so files the tasks create belong to the same user as the website:

bash
sudo crontab -u www-data -e
txt
* * * * * cd /var/www/exchange && php artisan schedule:run >> /dev/null 2>&1

Every minute, schedule:run checks the list and starts the tasks that are due.

Check it runs ​

bash
php artisan schedule:list

This lists every task with its next run time. To see that cron really calls it, look for schedule:run in the system log:

bash
grep CRON /var/log/syslog | tail

In the admin panel: System Monitor has a scheduler check, and Market services shows whether the core processes are running. If they never start, the scheduler isn't running (they're started by pm:watcher).

One server only

If you run the platform on several servers, add the cron entry on one of them. Most tasks use withoutOverlapping(), which uses the shared cache to avoid running the same task twice at once, but deposit monitors on two servers would still compete.

Every task by area ​

Times are in UTC (the platform's timezone). "No overlap" means a new run is skipped while the previous one is still working.

Process watchers ​

CommandRunsWhat it does
pm:watcherEvery minuteKeeps PM2 in line with config/pm.php: starts missing services (Horizon, Soketi, chart, order processor, stop trigger, bots, liquidity runners, price tracker and, on plan 5, futures, P2P and options), leaves alone services an admin stopped, and restarts workers that stopped responding (no heartbeat). Turn off with PM_SERVICE_WATCHER_ENABLED=false.
pm:market-watcherEvery minuteOnly with PM_LIQUIDITY_MODE=per-market: starts a liquidity process (LIQ-<market>) for every market with liquidity on. In the default shared mode the liquidity-binance / liquidity-custom services do this. Turn off with PM_MARKET_WATCHER_ENABLED=false.
system-monitor:test --alertEvery 5 minutesChecks every service and emails the admin address if something is offline. See System Monitor.

Deposits and withdrawals ​

CommandRunsWhat it does
deposits:scan <network>Every minute, one per networkDetects deposits on ETH, ERC-20, BNB, BEP-20, Polygon, MATIC-20, TRX and TRC-20 (every network with a scanner in config/networks.php), and credits the confirmed ones. See Adding a network
solana:monitor-sol-deposits, solana:monitor-spl-depositsEvery minuteDetects SOL and SPL token deposits
deposits:sweep <network>Every 3 minutes, one per networkMoves confirmed deposits from user addresses to the hot wallet on ETH, ERC-20, BNB, BEP-20, Polygon, MATIC-20, TRX, TRC-20, SOL and SPL (each deposit claimed once)
withdrawals:syncEvery minuteFinishes withdrawals once the network's bridge wrote the transaction (paid out) or marked them failed (refunded once), on every bridge network
withdrawal:automateEvery 2 minutesSends approved withdrawals automatically. Only works when ENABLE_AUTO_WITHDRAWALS=true.
wallets:payeer-wallet-withdraw-automate, wallets:perfect-money-wallet-withdraw-automateEvery minuteAutomatic Payeer and Perfect Money payouts
bonus:process-depositsEvery minuteAwards deposit bonuses. Only works when DEPOSIT_BONUS_ENABLED=true.
users:backfill-first-depositEvery minuteRecords the USD value of each user's first confirmed deposit (used for the wallet-transfer fee threshold)

System wallet balances ​

These refresh the hot-wallet balances shown in Reports → Wallets.

CommandRuns
wallets:ethereum-wallet-balance, wallets:bnb-wallet-balance, wallets:trx-wallet-balance, wallets:btc-wallet-balance, wallets:solana-wallet-balance, wallets:ripple-wallet-balance, wallets:ton-wallet-balanceEvery 5 minutes
wallets:matic-wallet-balanceEvery 15 minutes
wallets:payeer-wallet-balance, wallets:perfect-money-wallet-balance, wallets:fireblocks-balanceEvery minute

Markets and charts ​

CommandRunsWhat it does
markets:sparklinesEvery 2 hoursRebuilds the 24-hour mini-charts on the Markets page (pages only read the cached result)
chart:warm-cache --allEvery 5 minutesRefreshes cached candles for markets that use external chart data (Binance, MEXC or Bybit)
market-monitor:statsDaily, 00:00Saves bid, ask, high, low and market cap to each market, and resets the 24h high, low and volume of markets without a liquidity provider
market:last-price-updateDaily, 00:00Sets the last price of liquidity-provider markets to Binance's previous close
market:fiat-currency-ratesDaily, 23:59Updates fiat exchange rates (uses CURRENCYAPI_KEY)
matching-engine:check-syncEvery 5 minutesIf the Rust matching engine is on and lost its order books, reloads them from the database
cache:prune-stale-tagsHourlyCleans up old cache entries in Redis

Earn, futures and lending ​

CommandRunsWhat it does
staking:rewards-calculateDaily, 00:00Adds the day's reward to every active stake
staking:statusDaily, 23:30Completes matured stakes and returns principal plus rewards
launchpad:state-monitorEvery minuteOpens and closes token sales by their dates and caps
transaction:referral-creditsEvery minuteRecords multi-level referral commissions and credits them to wallets
airdrops:distributeEvery minutePays airdrops whose payout time has passed
referrals:evaluateHourly at :12Recalculates referral tiers of referrers whose friends were active
referrals:evaluate --allDaily at 00:35Recalculates every referral tier
futures:funding-feesHourlyCharges or pays funding on open futures positions that are due
lending:interest-takerHourlyCharges interest on open loans
lending:liquidation-watcherEvery minuteLiquidates loans whose collateral fell too far
margin:interestHourlyCharges one hour of interest on open margin loans
margin:monitorEvery minuteMargin levels, margin calls and liquidation of margin accounts
orders:trigger-stopsEvery minuteSafety net for stop-limit, OCO stop, trailing-stop and TP/SL orders: checks every 3 seconds during the minute, but only while the stop-trigger worker isn't running (that worker reacts within a second of a trade or price move)

Accounts and notifications ​

CommandRunsWhat it does
account-levels:evaluateHourly at :07Recalculates the VIP level of users active in the last 70 minutes
account-levels:evaluate --allDaily at 00:20Recalculates every user's VIP level
notifications:pruneDaily at 03:40Deletes Notification Center items older than 90 days
statements:pruneDaily at 03:40Deletes account statement files older than 30 days, re-queues statements stuck in Preparing
queue:prune-failed --hours=168Daily at 03:50Deletes failed jobs older than a week

P2P ​

CommandRunsWhat it does
peer-order-appeal:watcherEvery minuteNotifies the admin about new P2P appeals
peer-order:profile-statsEvery 5 minutesUpdates P2P merchant statistics (completion rate, order counts)

Expired P2P orders are cancelled by the peer-order-processor PM2 process, not by the scheduler.

Merchant payments ​

The merchant module schedules most of these itself (MerchantServiceProvider), so they appear in schedule:list but not in Kernel.php; only merchant:process-webhooks is in Kernel.php. Each runs once per interval.

CommandRunsWhat it does
merchant:monitor-deposits, merchant:monitor-btc-depositsEvery minuteDetects payments to merchant invoices
merchant:sync-transfersEvery minuteFinishes payouts, refunds and collections from bridge results
Invoice expiry check (job)Every minuteExpires unpaid invoices
Pending webhooks (job)Every minuteSends queued merchant webhooks
Asset rates refresh (job)Every 30 secondsUpdates the rates used to price invoices
merchant:collect-fundsEvery 5 minutesCollects paid invoice funds
merchant:process-webhooks --pending --retryEvery minuteSends and retries webhooks to merchants
merchant:process-payouts --limit=10Every 2 minutesSends approved merchant payouts
merchant:process-refunds --limit=10Every 2 minutesSends approved refunds

Card on-ramp ​

CommandRunsWhat it does
unlimit:sync-configEvery 15 minutesRefreshes the Unlimit (GateFi) currency list. Does nothing unless UNLIMIT_ENABLED=true.

Read-only (demo) mode ​

When READ_ONLY_MODE=true, the scheduler runs only pm:watcher, pm:market-watcher and markets:sparklines. Deposit detection, rewards and every other task are skipped. Never enable read-only mode on a live exchange.

Running a task by hand ​

Any task can be run directly, which is useful to test it or to catch up after downtime:

bash
php artisan markets:sparklines
php artisan staking:status
php artisan deposits:scan erc20

The output prints to your terminal. Run commands as the web server user so that log and cache files keep the right owner:

bash
sudo -u www-data php artisan markets:sparklines

To run everything that's due right now, once: php artisan schedule:run. All custom commands are listed in Artisan commands.

Fill the mini-charts after installing

The Markets page mini-charts appear after the first markets:sparklines run (every 2 hours). To fill them at once with real prices from Binance, MEXC or Bybit, run php artisan markets:sparklines-seed.

Owner documentation for the CryptoTech exchange platform.