[go: up one dir, main page]

Menu

[r1]: / action.php  Maximize  Restore  History

Download this file

36 lines (30 with data), 626 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
include_once 'functions.php';
$service=getService($_GET['service']);
if(!isset($service['id'])) {
echo "failed";
die();
}
$machine=$service['machine'];
$host=$machine['host'];
$user=$machine['user'];
$pass=$machine['password'];
$port=$machine['ssh_port'];
$srv_name=$service['service_name'];
$cmd="/etc/init.d/$srv_name ";
switch($_GET['action']){
case "start":
$cmd.=" start";
break;
case "stop":
$cmd.=" stop";
break;
case "restart":
$cmd.=" restart";
break;
default:
die();
}
$out = execute_ssh_command($host, $port, $user, $pass, $cmd);
echo "success";
?>