Running the Forkiva Schedule
Forkiva uses Laravel’s Task Scheduler to automatically perform background operations such as generating reports, sending emails, and maintaining system data.
To keep your system running smoothly, you must make sure the schedule runs automatically every minute.
This guide explains how to properly configure and run the Forkiva scheduler on both VPS servers and Shared Hosting.
What Is the Forkiva Scheduler?
The scheduler is a background process that triggers all time-based system tasks automatically. To make this work, your server needs to call the following Laravel command every minute:
bash
php artisan schedule:runRunning the Scheduler on a VPS Server (Recommended)
If you have your Forkiva project installed on a VPS or cloud server (such as AWS, DigitalOcean, or Vultr) with SSH access, use this setup for best performance and reliability.
Step 1: Connect to Your Server
Open an SSH connection using your credentials:
bash
ssh username@your-server-ip(Replace username and your-server-ip with your actual credentials.)
Step 2: Open the Crontab
Once connected, open the cron configuration file:
bash
crontab -eStep 3: Add the Forkiva Scheduler Command
At the end of the file, add the following line:
bash
* * * * * cd /var/www/forkiva && php artisan schedule:run >> /dev/null 2>&1⚠️ Important: Replace
/var/www/forkivawith the full path to your Forkiva project.
Explanation
| Part | Description |
|---|---|
* * * * * | Runs the command every minute. |
cd /var/www/forkiva | Moves into your Forkiva project directory. |
php artisan schedule:run | Executes the Laravel scheduler. |
>> /dev/null 2>&1 | Hides output from logs (optional but recommended). |
Step 4: Save and Verify
After saving, confirm your cron job is active:
bash
crontab -lThen, wait a few minutes and check if the tasks are running:
bash
tail -f storage/logs/laravel.logYou should see logs similar to:
Running scheduled command: App\Console\Commands\SyncReportsRunning the Scheduler on Shared Hosting
If you’re hosting Forkiva on a shared hosting platform (like cPanel, Plesk, or DirectAdmin), you can configure the scheduler using your control panel.
Step 1: Find Your Project Path
Locate your Forkiva project directory path — typically one of the following:
/home/username/public_html
/home/username/public_html/forkiva
/home/username/forkivaTip: You can confirm this path inside your cPanel File Manager.
Step 2: Create a Cron Job in cPanel
- Log in to your cPanel or hosting dashboard.
- Go to Advanced → Cron Jobs.
- Under Add New Cron Job, select Every Minute for all time fields.
- In the Command field, paste the following:
bash
cd /home/username/public_html/forkiva && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1🟢 Note: The PHP path may vary depending on your hosting provider.
You can check it by running:bashwhich phpCommon paths include:
/usr/bin/php/usr/local/bin/php/opt/alt/php82/usr/bin/php
Step 3: Save and Test
After saving, cPanel will automatically execute your cron job every minute.
To verify it’s working, open your Forkiva logs:
bash
storage/logs/laravel.logYou should see scheduled task entries appear within a few minutes.
Test the Scheduler Manually
If you want to test the scheduler manually, run this command from your Forkiva project root:
bash
php artisan schedule:runYou should see output like:
Running scheduled command: App\Console\Commands\ForkivaSyncBest Practices
- Run Every Minute: Forkiva’s scheduler internally manages all timings — so you only need one cron job running per minute.
- Use Absolute Paths: Always include full paths in your cron command.
- Match PHP Version: Use the same PHP binary version as your Forkiva app.
- Suppress Output: Use
>> /dev/null 2>&1to keep cron logs clean. - Monitor Logs: Regularly check
storage/logs/laravel.logto ensure tasks are running successfully.
Example for Multiple Forkiva Projects
If you manage multiple Forkiva environments (like staging and production), add separate cron jobs for each:
bash
* * * * * cd /home/user/forkiva-staging && php artisan schedule:run >> /dev/null 2>&1
* * * * * cd /home/user/forkiva-production && php artisan schedule:run >> /dev/null 2>&1Summary
| Environment | Command | Where to Configure |
|---|---|---|
| VPS Server | * * * * * cd /var/www/forkiva && php artisan schedule:run >> /dev/null 2>&1 | Via SSH → crontab -e |
| Shared Hosting | cd /home/username/public_html/forkiva && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1 | Via cPanel → Cron Jobs |
Troubleshooting
| Issue | Solution |
|---|---|
| Tasks not running | Ensure cron is set to run every minute and points to the correct Forkiva path. |
| “php: command not found” | Use the full PHP binary path (e.g., /usr/local/bin/php). |
| Permission denied | Check directory permissions and user access. |
| Log not updating | Run chmod 775 -R storage/logs to fix permissions. |
