Stop Services

Use Stop Services API to stop particular service on VPS of your server.

HTTP Request

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

Parameters

NameTypeValueDescriptionRequired
actGETservicesThe action which will list services that are running inside the vpsYes
svsPOSTvpsidThe vpsid whose services have to be stopped. Will be sent via URLYes
vidPOSTvpsidThe vpsid whose services have to be stopped. Will be sent as a POST ParameterYes
stop_xPOST1/0If set then the start method will stop the processYes
sel_servPOSTsel_servName of the service that needs to be startedYes

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['stop_x'] = 1;
    $post['sel_serv'][] = 'sshd';

    $output = $admin->services($post,$vid);

    print_r(json_encode($output));
?>

Curl

curl -k -X POST -d "stop_x=1&sel_serv[]=sshd" -L 
"https://hostname:4083/index.php?act=services& 
svs=3615&api=json&apikey=your_api_key& 
apipass=your_api_pass"

Output

{
    "uid": "372",
    "act": "services",
    "timezone": 1,
    "timenow": "October 11, 2016, 3:50 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": "Services",
    "services": {
        "0": "init",
        "1": "kthreadd/105",
        "2": "khelper/105",
        "3": "udevd",
        "4": "rsyslogd",
        "5": "xinetd",
        "6": "saslauthd",
        "7": "sendmail",
        "8": "httpd",
        "9": "mingetty",
        "10": "crond",
        "12": "iptables",
        "13": "modules_dep",
        "14": "network",
        "15": "rsyslog",
        "18": "sshd",
        "19": "vzquota"
    },
    "autostart": ["crond", "httpd", "iptables", "modules_dep", "network", "rsyslog", "saslauthd", "sendmail", "sshd", "vzquota", "xinetd"],
    "running": {
        "1": "init",
        "2": "kthreadd/105",
        "3": "khelper/105",
        "4": "udevd",
        "5": "rsyslogd",
        "6": "xinetd",
        "7": "saslauthd",
        "9": "sendmail",
        "10": "httpd",
        "13": "mingetty"
    },
    "time_taken": "1.762"
}
Was this helpful to you?