Kill Processes

Use Kill Processes API to kill running processes on VPS of your server.

HTTP Request

https://hostname:4083/index.php?act=processes&svs=vpsid

Parameters

NameTypeValueDescriptionRequired
actGETprocessesThe action list processes after the selected processes have been killedYes
svsPOSTvpsidThe vpsid whose processes need to be killed. Sent using URL.Yes
vidPOSTIntThe vpsid whose processes need to be killed. Sent as a post parameter.Yes
sel_procPOSTIntThe list of processes that will be killed.Yes

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);

    $vid = 3615;    
    $post['sel_proc'] = array(75,83,128);
    $output = $admin->processes($post,$vid);

    print_r(json_encode($output));
?>

Curl

curl -k -X POST -d "sel_proc[]=144&sel_proc[]=7270" -L 
"https://hostname:4083/index.php?act=processes& 
svs=3615&api=json&apikey=your_api_key& 
apipass=your_api_pass"

Output

{
    "uid": "372",
    "act": "processes",
    "timezone": 1,
    "timenow": "October 11, 2016, 1:41 am",
    "vpsid": 3615,
    "username": "test@test.com",
    "user_type": "2",
    "preferences": {
        "fname": "test",
        "lname": "test",
        "language": "english",
        "theme": "default",
        "timezone": 1,
        "logo": ""
    },
    "url": "index.php?",
    "rdns": {
        "pdnsid": "12"
    },
    "pdns": {
        "pdnsid": "12"
    },
    "support_link": "http://softaculous.com",
    "title": "List of Processes",
    "processes": [{
        "PID": "1",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.3",
        "RSS": "3564",
        "TT": "?",
        "STAT": "Ss",
        "TIME": "00:00:01",
        "COMMAND": "init -z"
    }, {
        "PID": "2",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.0",
        "RSS": "0",
        "TT": "?",
        "STAT": "S",
        "TIME": "00:00:00",
        "COMMAND": "[kthreadd/105]"
    }, {
        "PID": "3",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.0",
        "RSS": "0",
        "TT": "?",
        "STAT": "S",
        "TIME": "00:00:00",
        "COMMAND": "[khelper/105]"
    }, {
        "PID": "120",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.1",
        "RSS": "1524",
        "TT": "?",
        "STAT": "Ss",
        "TIME": "00:00:00",
        "COMMAND": "/usr/lib/systemd/systemd-logind"
    }, {
        "PID": "122",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.3",
        "RSS": "3596",
        "TT": "?",
        "STAT": "Ss",
        "TIME": "00:00:00",
        "COMMAND": "/usr/sbin/sshd -D"
    }, {
        "PID": "144",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.0",
        "RSS": "796",
        "TT": "tty2",
        "STAT": "Ss+",
        "TIME": "00:00:00",
        "COMMAND": "/sbin/agetty --noclear tty2 linux"
    }, {
        "PID": "145",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.0",
        "RSS": "792",
        "TT": "tty1",
        "STAT": "Ss+",
        "TIME": "00:00:00",
        "COMMAND": "/sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220"
    }, {
        "PID": "7270",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.1",
        "RSS": "1872",
        "TT": "?",
        "STAT": "Ss",
        "TIME": "00:00:00",
        "COMMAND": "/usr/lib/systemd/systemd-journald"
    }, {
        "PID": "7277",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.1",
        "RSS": "1612",
        "TT": "?",
        "STAT": "Ss",
        "TIME": "00:00:00",
        "COMMAND": "/usr/lib/systemd/systemd-udevd"
    }, {
        "PID": "7283",
        "USER": "root",
        "%CPU": "0.0",
        "%MEM": "0.1",
        "RSS": "1628",
        "TT": "?",
        "STAT": "Rs",
        "TIME": "00:00:00",
        "COMMAND": "ps ax -eo pid,user,pcpu,pmem,rss,tty,stat,time,command"
    }],
    "processes_head": ["PID", "USER", "%CPU", "%MEM", "RSS", "TT", "STAT", "TIME", "COMMAND"],
    "time_taken": "1.572"
}
Was this helpful to you?