Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <Form Name ="form1" Method ="POST" ACTION = "">
- <p> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Start"> </p>
- <p> <INPUT TYPE = "Submit" Name = "Submit2" VALUE = "Stop"> </p>
- <p> <INPUT TYPE = "Submit" Name = "Submit3" VALUE = "kill"> </p>
- </form>
- </html>
- <?php
- set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
- include('Net/SSH2.php');
- $config = include('/home/xxx/mc/mc-login.php');
- $host= $config['host'];
- $pass= $config['pass'];
- $port= $config['port'];
- $user= $config['username'];
- $ssh = new Net_SSH2($host,$port);
- if (!$ssh->login($user, $pass)) {
- exit('Login Failed');
- }
- /*
- */
- if ( isset( $_POST['Submit1'] ) ) {
- echo "1: ";
- echo $ssh->exec('cd mc/ && screen -dmS mc_test ./s.sh'); //start
- }
- if ( isset( $_POST['Submit2'] ) ) {
- echo "2: ";
- echo $ssh->exec('screen -S mc_test -X stuff "stop$(printf \\r)"'); //stop
- }
- if ( isset( $_POST['Submit3'] ) ) {
- echo "3: ";
- echo $ssh->exec('killall java'); //kill
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement