Use Start Self Shutdown API to automatically schedule ( start | stop | restart | power off ) actions on VPS at time specified on your server.
HTTP Request
https://hostname:4083/index.php?act=self_shutdown&svs=vpsid
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | self_shutdown | The action specified to retrieve data | Yes |
svs | POST | Int | The vps id which is needed to set the shutdown timer | Yes |
selfshutdown | POST | 1 | IF set, the shutdown time will be saved | Yes |
shutdown_action | POST | 0-3 | What action has to be carried out(Start/Stop/Restart/Poweroff) | Yes |
shutdown_date | POST | mm/dd/yyyy | The date when self shtudown action should be carried out | Yes |
shutdown_hrs | POST | hh | Time in hrs for self shutdown | Yes |
shutdown_min | POST | mm | Time in mins for self shutdown | Yes |
Action
Shutdown action | Values |
---|---|
Start | 0 |
Stop | 1 |
Restart | 2 |
Power Off | 3 |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = '';
$pass = '';
$ip = '';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$vid = 3384;
$post = array();
$post['selfshutdown'] = 1;
$post['shutdown_action'] = 3;
$post['shutdown_date'] = '08/29/2016';
$post['shutdown_hrs'] = 12;
$post['shutdown_min'] = 36;
$output = $admin->self_shutdown($vid, $post);
print_r(json_encode($output));
?>
Curl
curl -k -X POST -d "selfshutdown=1&shutdown_action=1&
shutdown_date=09/26/2016&shutdown_hrs=03&shutdown_min=45" -L
"https://hostname:4083/index.php?act=self_shutdown&svs=3511&api=json
&apikey=your_api_key&apipass=your_api_pass&do=1"
Output
{
"uid": "321",
"act": "self_shutdown",
"timezone": 0,
"timenow": "September 25, 2016, 4:36 am",
"vpsid": 3511,
"username": "test@test.com",
"user_type": "2",
"preferences": {
"fname": "test",
"lname": "test",
"language": "english",
"theme": "default",
"timezone": 0,
"logo": ""
},
"url": "index.php?",
"rdns": {
"pdnsid": null
},
"support_link": "http://softaculous.com",
"disable_login_logo": 1,
"title": "Self Shutdown",
"error": {
"timesp": "1474778163"
},
"self_shutdown": {
"page": {
"start": 0,
"len": 50,
"maxNum": "1"
},
"self_shutdown": {
"6": {
"id": "6",
"vpsid": "3511",
"time": "09/26/2016 03:45",
"action": "1",
"status": null,
"date": "09/26/2016",
"hours": "03",
"minutes": "45"
}
}
},
"done": {
"msg": "Action added",
"done": true
},
"time_taken": "0.108"
}