Create crontab

Create a new cron job on your server.


POST/api/servers/{server}/crontabs

Create a crontab

This endpoint allows you to create a new cron job on your server.

Required scopes

Create cronjobs

Required attributes

  • Name
    user
    Type
    string
    Description

    The system user to run the cron job as. Max: 255 characters.

  • Name
    command
    Type
    string
    Description

    The command to execute. Max: 255 characters.

  • Name
    frequency
    Type
    string
    Description

    The cron frequency expression (e.g., * * * * *). Max: 50 characters.

Request

POST
/api/servers/{server}/crontabs
curl -X POST "https://ploi.io/api/servers/{server}/crontabs" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "user": "ploi",
    "command": "/home/ploi/domain.com/php artisan schedule:run",
    "frequency": "* * * * *"
  }'

Response

{
  "data": {
    "id": 1,
    "command": "/home/ploi/domain.com/php artisan schedule:run",
    "user": "ploi",
    "frequency": "* * * * *",
    "created_at": "2019-07-16 13:05:58"
  }
}