Create cronjob

The cronjob:create command allows you to create a new cronjob on a server.

ploi cronjob:create

Create a cronjob with all options:

ploi cronjob:create --server=blue-ocean --user=ploi --command="php artisan schedule:run" --frequency="* * * * *"

Options

OptionDescription
--server=The server name or ID
--user=The system user to run the cronjob as
--command=The command to execute
--frequency=The cron schedule expression

Frequency Presets

When running interactively, you can choose from these presets:

  • Every minute (* * * * *)
  • Hourly (0 * * * *)
  • Nightly at 2am (0 2 * * *)
  • Weekly (0 0 * * 0)
  • Monthly (0 0 1 * *)
  • Custom (enter your own cron expression)

Example Cron Expressions

ExpressionDescription
* * * * *Every minute
0 * * * *Every hour
0 0 * * *Every day at midnight
0 0 * * 0Every Sunday at midnight
0 0 1 * *First day of every month