Cron Job Setup
The BC Export system runs automatically via server cron jobs. This guide shows you how to install and verify the cron jobs.
Overview
Two cron scripts handle the Business Central export:
| Script | Frequency | Purpose |
|---|---|---|
| bc-insert-items.php | Every 10 minutes | Push orders to Business Central |
| bc-verify-items.php | Every 10 minutes | Verify BC processing & get Sales Order numbers |
Installation
Linux/Mac Server
-
Open crontab editor:
crontab -e -
Add these lines (adjust paths for your installation):
# GSM Middleware — BC Insert Items (every 10 minutes)
*/10 * * * * /usr/bin/php /var/www/html/wp-content/plugins/gsm-middleware/cron/bc-insert-items.php >> /var/log/gsm-middleware/bc-insert-items.log 2>&1
# GSM Middleware — BC Verify Items (every 10 minutes)
*/10 * * * * /usr/bin/php /var/www/html/wp-content/plugins/gsm-middleware/cron/bc-verify-items.php >> /var/log/gsm-middleware/bc-verify-items.log 2>&1 -
Save and exit
-
Verify:
crontab -l | grep "GSM Middleware"
Windows Server (Task Scheduler)
- Open Task Scheduler
- Create task for BC Insert:
- Name: GSM BC Insert Items
- Trigger: Every 10 minutes
- Action:
C:\php\php.exe - Arguments:
C:\inetpub\wwwroot\wp-content\plugins\gsm-middleware\cron\bc-insert-items.php
- Repeat for BC Verify
Testing
Test manually before installing:
php wp-content/plugins/gsm-middleware/cron/bc-insert-items.php
Expected output:
[2026-03-17 12:00:00 UTC] GSM BC Insert Items starting...
Processed: 10, Success: 10, Failed: 0
[2026-03-17 12:00:05 UTC] GSM BC Insert Items complete in 5s.
Monitoring
Check logs:
tail -f /var/log/gsm-middleware/bc-insert-items.log
Next Steps
- Test the Export - Verify operations
- Monitor Operations - Track export status