Cloud HostingLaunch UnoPim on fully-managed cloud hosting — fast, secure and cost-effective plans.
Skip to content

Installation

Follow the steps below to install the UnoPim Job Scheduler. You'll need terminal access to your server before getting started.


Step 1 - Add the Package

Place the package at the following location in your UnoPim project:

packages/Webkul/JobScheduler/

Then open your root composer.json and add the PSR-4 autoload entry under autoload > psr-4:

json
{
    "autoload": {
        "psr-4": {
            "Webkul\\JobScheduler\\": "packages/Webkul/JobScheduler/src"
        }
    }
}

Step 2 - Register the Service Provider

Open bootstrap/providers.php and append JobSchedulerServiceProvider to the providers array:

php
<?php

use Webkul\JobScheduler\Providers\JobSchedulerServiceProvider;
// ... other use statements

return [
    // ... other providers
    JobSchedulerServiceProvider::class,
];

NOTE

This registers JobSchedulerServiceProvider in Laravel so the module can bootstrap scheduler services, bindings, and package configuration during application startup.


Step 3 - Register the Concord Module Provider

UnoPim uses Concord for model discovery. Open config/concord.php and add the Job Scheduler module provider to the modules array:

php
return [
    'convention' => CoreConvention::class,

    'modules' => [
        // ... other modules
        Webkul\JobScheduler\Providers\ModuleServiceProvider::class,
    ],
];

Step 4 - Dump Autoload and Run the Installer

Run the following two commands in order:

bash
composer dump-autoload
php artisan job-scheduler:install
CommandPurpose
composer dump-autoloadRegenerates Composer's autoloader mapping to include the newly added namespace.
php artisan job-scheduler:installRuns the Job Scheduler installer and required database migrations.

The installer runs the 4 required database migrations - destinations, jobs, executions, and logs.

Alternatively, run the migrations manually:

bash
php artisan migrate --path=packages/Webkul/JobScheduler/Database/Migration --force
CommandPurpose
php artisan migrate --path=packages/Webkul/JobScheduler/Database/Migration --forceRuns only Job Scheduler migration files directly from the package path.

Note: Tables are created using your configured DB_PREFIX. For example, if your prefix is job_, the jobs table will be named job_job_scheduler_jobs.


Step 5 - Set Up the Cron Entry

The scheduler needs a single crontab entry on your server. Laravel's built-in task scheduler handles all the job timing logic from there - you don't need a separate cron entry for each job.

Open your crontab:

bash
crontab -e
CommandPurpose
crontab -eOpens the current user's crontab editor to add or update scheduled cron entries.

Add the following line, replacing /path/to/your/unopim with your actual project path:

bash
* * * * * cd /path/to/your/unopim && php artisan schedule:run >> /dev/null 2>&1
CommandPurpose
* * * * * cd /path/to/your/unopim && php artisan schedule:run >> /dev/null 2>&1Runs Laravel's scheduler every minute so due scheduled tasks are dispatched on time.

This runs every minute and lets Laravel check which scheduled jobs are due to execute.


Step 6 - Start the Queue Worker

Scheduled jobs are dispatched to the job-scheduler queue. A queue worker must be running for them to execute.

For local development or testing:

bash
php artisan queue:work --queue=job-scheduler
CommandPurpose
php artisan queue:work --queue=job-schedulerStarts a queue worker dedicated to processing Job Scheduler queue jobs.

For production - use Supervisor:

In production, use Supervisor to keep the worker running reliably. If it crashes or the server restarts, Supervisor will bring it back automatically.

Create a Supervisor config file (e.g., /etc/supervisor/conf.d/job-scheduler-worker.conf) with the following contents:

ini
[program:job-scheduler-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/your/unopim/artisan queue:work --queue=job-scheduler --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
numprocs=2
redirect_stderr=true
stdout_logfile=/path/to/your/unopim/storage/logs/job-scheduler-worker.log

Key settings explained:

SettingWhat it does
numprocs=2Runs two worker processes in parallel
--tries=3Retries each failed job up to 3 times
--max-time=3600Restarts workers after 1 hour to prevent memory leaks
autostart / autorestartSupervisor starts and restarts the worker automatically
stdout_logfileWorker logs are saved to your UnoPim storage/logs folder

After creating the config file, activate it with:

bash
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start job-scheduler-worker:*
CommandPurpose
sudo supervisorctl rereadReloads Supervisor configuration files without restarting Supervisor.
sudo supervisorctl updateApplies newly added or changed Supervisor program definitions.
sudo supervisorctl start job-scheduler-worker:*Starts all configured Job Scheduler worker processes under Supervisor.

Verify the Installation

Once all steps are complete, log in to your UnoPim dashboard. You should see the Job Scheduler option in the left sidebar - confirming the extension is installed and ready to use.

Job Scheduler Menu

Released under the MIT License.