Hyper Docs
  • Introduction
  • What is Hyper
  • Why Hyper
  • Regions
  • Pricing
  • Quota and Limits
  • FAQ
  • Getting Started
    • Generate API Credential
    • Install CLI
    • Part 1 - Starting and inspecting your first container
    • Part 2 - Working with multiple containers
    • Part 3 - Hyper Compose
    • Migrate data
      • hyper container as client
      • hyper container as server
  • Features
    • Container
      • Container
      • Logs
      • Compose
      • Cron
      • Service
      • Func
    • Storage
      • Volume
      • Snapshot
    • Network
      • Network
      • Floating IP
      • Port
      • Security Group
    • Console
      • Filter
  • Reference
    • CLI
      • attach
      • commit
      • config
      • create
      • exec
      • images
      • info
      • inspect
      • kill
      • load
      • login
      • logout
      • logs
      • port
      • ps
      • pull
      • push
      • rename
      • restart
      • rm
      • rmi
      • run
      • search
      • start
      • stats
      • stop
      • version
      • update
      • wait
      • Volume
        • create
        • init
        • inspect
        • ls
        • rm
      • Snapshot
        • create
        • ls
        • rm
      • FIP
        • allocate
        • attach
        • detach
        • ls
        • release
        • name
      • Security Group
        • create
        • ls
        • inspect
        • rm
        • update
      • Compose
        • create
        • down
        • up
        • rm
        • ps
        • pull
        • run
        • kill
        • start
        • stop
        • scale
      • Service
        • create
        • ls
        • inspect
        • scale
        • rolling-update
        • attach-fip
        • detach-fip
        • rm
      • Cron
        • create
        • inspect
        • ls
        • history
        • rm
      • Func
        • create
        • update
        • inspect
        • ls
        • rm
        • logs
        • call
        • get
    • API
      • 2016-04-04 [Ver. 1.23]
        • Container
          • List Containers
          • Create a container
          • Get container logs
          • Start a container
          • Stop a container
          • Restart a container
          • Resize a container
          • Rename a container
          • Kill a container
          • Attach to a container
          • Remove a container
          • Update a container
          • Get container stats
          • Inspect a container
          • Exec Create
          • Commit a container
        • Event
          • Monitor events with WebSocket
        • Misc
          • Display system-wide information
          • Show the hyper version information
          • Exec Start
          • Exec Resize
          • Exec Inspect
        • Image
          • Inspect Images
          • Search Images
          • List Images
          • Load Images
          • Create an image
          • Remove an image
          • Push an image
        • Volume
          • List volumes
          • Create a volume
          • Remove a volume
          • Init a volume
          • Inspect a volume
        • Snapshot
          • Create a snapshot
          • List snapshots
          • Inspect a snapshot
          • Remove a snapshot
        • Network
          • Allocate floating IP
          • Attach a floating IP to a (running) container
          • Detach floating IP from a (running) container
          • List floating IP
          • Release floating IP
          • Name floating IP
        • Security Group
          • Create a security group
          • Remove a security group
          • Inspect a security group
          • Update a security group
          • List security groups
        • Service
          • service create
          • service list
          • service inspect
          • service update
          • service remove
        • Compose
          • Compose up
          • Compose create
          • Compose down
          • Compose rm
          • Compose start
          • Compose stop
          • Compose kill
        • Cron
          • Cron create
          • Cron list
          • Cron inspect
          • Cron remove
          • Cron history
        • Func
          • Func create
          • Func update
          • Func list
          • Func inspect
          • Func remove
          • Func call
          • Func get
          • Func logs
          • Func status
    • Compose File Reference
    • Security Group Reference
  • FAQ
    • Pricing
    • Quota and Limits
    • Privacy Policy
    • Terms of Service
    • Acceptable Use Policy
  • Docs version
Powered by GitBook
On this page
  1. Reference
  2. API
  3. 2016-04-04 [Ver. 1.23]
  4. Cron

Cron create

POST /crons/create

Example request:

POST /crons/create HTTP/1.1
Content-Type: application/json

{
    "Name": "test-cron-job",
    "Schedule": "*/5 * * * *",
    "ContainerName": "",
    "Config": {
        "Hostname": "",
        "Domainname": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": [],
        "Cmd": [
            "ping",
            "-c",
            "3",
            "8.8.8.8"
        ],
        "Image": "busybox",
        "Volumes": {},
        "WorkingDir": "",
        "Entrypoint": [],
        "Labels": {
            "sh_hyper_instancetype": "s4"
        },
        "StopSignal": "SIGTERM"
    },
    "HostConfig": {
        "Binds": [],
        "NetworkMode": "bridge",
        "PortBindings": {},
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "AutoRemove": false,
        "Links": [],
        "PublishAllPorts": false,
    },
    "NetConfig": {
        "EndpointsConfig": {}
    },
    "OwnerEmail": "",
}

Example response:

HTTP/1.1 201 Created
Content-Type: application/json

{
    "Name": "test-cron-job",
    "Schedule": "*/5 * * * *",
    "ContainerName": "",
    "Config": {
        "Hostname": "",
        "Domainname": "",
        "Env": [],
        "Cmd": [
            "ping",
            "-c",
            "3",
            "8.8.8.8"
        ],
        "Image": "busybox",
        "Volumes": {},
        "WorkingDir": "",
        "Entrypoint": [],
        "Labels": {
            "sh_hyper_instancetype": "s4"
        },
        "StopSignal": "SIGTERM"
    },
    "HostConfig": {
        "Binds": [],
        "NetworkMode": "bridge",
        "PortBindings": {},
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "Links": [],
        "PublishAllPorts": false,
    },
    "NetConfig": {
        "EndpointsConfig": {}
    },
    "OwnerEmail": "xxx@hyper.sh",
}

Json parameters:

  • Name – Cron job name.

  • Schedule - Schedule rule of cron job.

  • ContainerName - Cron job's container name.

  • OwnerEmail - Notification email.

  • Config

    • Labels – A list of labels in format key=value.

    • Image – A string specifying the image name to use for the container.

    • Cmd – The command to run when starting the container.

    • Env – A list of environment variables in the form of ["VAR=value"[,"VAR2=value2"]].

    • Entrypoint - Set the entry point for the container as a string or an array of strings.

    • Image - A string specifying the image name to use for the container.

    • WorkingDir - A string specifying the working directory for commands to run in.

    • ExposedPorts - An object mapping ports to an empty object in the form of:

      `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
    • StopSignal - Signal to stop a container as a string or unsigned integer. SIGTERM by default.

  • HostConfig

    • Binds – A list of volume bindings for this container. Each volume binding is a string in one of these forms:

      • container_path to create a new volume for the container

      • volume_name:container_path to bind-mount a volume managed by a volume plugin into the container.

    • Links - A list of links for the container. Each link entry should be

      in the form of container_name:alias.

    • PortBindings - A map of exposed container ports and the host port they

      should map to. A JSON object in the form

      { <port>/<protocol>: [{ "HostPort": "<port>" }] }

      Take note that port is specified as a string and not an integer value.

    • PublishAllPorts - Allocates a random host port for all of a container's

      exposed ports. Specified as a boolean value.

    • RestartPolicy – The behavior to apply when the container exits. The

      value is an object with a Name property of either "always" to

      always restart, "unless-stopped" to restart always except when

      user has manually stopped the container or "on-failure" to restart only when the container

      exit code is non-zero. If on-failure is used, MaximumRetryCount

      controls the number of times to retry before giving up.

      The default is not to restart. (optional)

      An ever increasing delay (double the previous delay, starting at 100mS)

      is added before each restart to prevent flooding the server.

    • NetworkMode - Sets the networking mode for the container. Supported

      values are: bridge.

Query Parameters:

  • name – Assign the specified name to the cron job. Must

    match [a-z0-9]([-a-z0-9]*[a-z0-9])?.

Status Codes:

  • 201 – no error

  • 400 – bad parameter

  • 409 – name conflicts with an existing object

  • 500 - server error

PreviousCronNextCron list

Last updated 7 years ago