Cron Job

Create cron job

Parameters
labelrequiredLabel of the Cron Job
usernamerequiredLinux System User that will be running this job
commandrequiredFull command of job to be running/td>
minuterequiredCrontab syntax for minute
hourrequiredCrontab syntax for hour
dayOfMonthrequiredCrontab syntax for the day of month
monthrequiredCrontab syntax for month
dayOfWeekrequiredCrontab syntax for the day of week

POST /servers/{serverId}/cronjobs

HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs
Request
curl --request POST \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
    "label": "my first job",
    "username": "root",
    "command": "/bin/bash /root/clearitem.sh",
    "minute": "*",
    "hour": "*/2",
    "dayOfMonth": "*",
    "month": "*",
    "dayOfWeek": "*"
}'
Response
{
	"id": 9,
	"label": "my first job",
	"username": "root",
	"time": "* */2 * * *",
	"command": "/bin/bash /root/clearitem.sh",
	"created_at": "2019-06-23 13:58:29"
}

List jobs

Query String Parameters
searchoptionalStringSearching string if you wanted to search from list of jobs

GET /servers/{serverId}/cronjobs

HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
	"data": [
		{
			"id": 9,
			"label": "my first job",
			"username": "root",
			"time": "* */2 * * *",
			"command": "/bin/bash /root/clearitem.sh",
			"created_at": "2019-06-23 13:58:29"
		},
		{
			"id": 7,
			"label": "test",
			"username": "runcloud",
			"time": "* * * * *",
			"command": "/bin/bash kjhj",
			"created_at": "2019-05-14 18:43:33"
		}
	],
	"meta": {
		"pagination": {
			"total": 2,
			"count": 2,
			"per_page": 15,
			"current_page": 1,
			"total_pages": 1,
			"links": {}
		}
	}
}

Job object

GET /servers/{serverId}/cronjobs/{jobId}

HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/{jobId}
Request
curl --request GET \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/9 \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
	"id": 9,
	"label": "my first job",
	"username": "root",
	"time": "* */2 * * *",
	"command": "/bin/bash /root/clearitem.sh",
	"created_at": "2019-06-23 13:58:29"
}

Rebuild jobs

POST /servers/{serverId}/cronjobs/rebuild

HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/rebuild
Request
curl --request POST \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/rebuild \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response

Delete job

DELETE /servers/{serverId}/cronjobs/{jobId}

HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/cronjobs/{jobId}
Request
curl --request DELETE \
  --url https://manage.runcloud.io/api/v2/servers/7/cronjobs/9 \
  -u YOUR_API_KEY:YOUR_API_SECRET \
  --header 'accept: application/json' \
  --header 'content-type: application/json'
Response
{
	"id": 9,
	"label": "my first job",
	"username": "root",
	"time": "* */2 * * *",
	"command": "/bin/bash /root/clearitem.sh",
	"created_at": "2019-06-23 13:58:29"
}