PieApp Cronjobs

PieApp lets you run scheduled tasks inside your application container using standard cron syntax. Cron jobs are defined in a pie.json file at the root of your repository and are installed into the container at build time.

This works for all app types — Laravel schedulers, WordPress cron, custom Node.js scripts, or any shell command your container can run.

Defining Cron Jobs 

Create a pie.json file in the root of your repository and add a crons array:

{
  "crons": [
    {
      "schedule": "* * * * *",
      "command": "/usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1"
    }
  ]
}

Each entry requires two keys:

Key Required Description
schedule Yes A standard 5-part cron expression.
command Yes The shell command to execute. Must be a single line.

Limits:

  • Maximum of 100 cron entries per app.
  • Commands cannot contain newline characters.
  • Schedule must be exactly 5 space-separated parts.

Schedule Syntax 

The schedule field follows standard cron expression format:

┌───────── minute       (0 - 59)
│ ┌─────── hour         (0 - 23)
│ │ ┌───── day of month (1 - 31)
│ │ │ ┌─── month        (1 - 12)
│ │ │ │ ┌─ day of week  (0 - 6, Sunday = 0)
│ │ │ │ │
* * * * *

Common expressions:

Expression Meaning
* * * * * Every minute
*/5 * * * * Every 5 minutes
0 * * * * Every hour, on the hour
0 2 * * * Every day at 2:00 AM
0 0 * * 0 Every Sunday at midnight
0 9 * * 1-5 Weekdays at 9:00 AM

Examples 

Laravel

Laravel's task scheduler requires one cron entry that runs every minute:

{
  "crons": [
    {
      "schedule": "* * * * *",
      "command": "/usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1"
    }
  ]
}

Then define all your scheduled tasks in app/Console/Kernel.php as usual.

WordPress

WordPress uses wp-cron.php for its internal task runner:

{
  "crons": [
    {
      "schedule": "*/5 * * * *",
      "command": "/usr/bin/php /app/wp-cron.php"
    }
  ]
}

It is recommended to disable WordPress's built-in pseudo-cron by adding define('DISABLE_WP_CRON', true); to wp-config.php when using this approach.

Node.js

For Node.js apps, call your script directly with the Node binary:

{
  "crons": [
    {
      "schedule": "0 * * * *",
      "command": "/usr/bin/node /app/scripts/hourly-sync.js"
    }
  ]
}

Multiple jobs

{
  "crons": [
    {
      "schedule": "* * * * *",
      "command": "/usr/bin/php /app/artisan schedule:run >> /dev/null 2>&1"
    },
    {
      "schedule": "0 3 * * *",
      "command": "/app/scripts/nightly-backup.sh"
    },
    {
      "schedule": "0 0 1 * *",
      "command": "/usr/bin/php /app/artisan invoices:generate"
    }
  ]
}

Deployment & Lifecycle 

  • Cron jobs are read from pie.json at the start of every deployment.
  • They are written into the container's crontab during the build step.
  • Changes to pie.json take effect after the next successful deployment.
  • If pie.json is missing or the crons array is empty, no cron jobs are configured.
  • Cron output is not captured in PieApp deployment logs. Redirect output yourself (e.g. >> /var/log/myjob.log 2>&1) if you need to debug a scheduled command.

Help

Facing difficulties? Use the chat box on the bottom-right corner of this page to reach us.