I am creating a simple dashboard for diagnosis tool to my Data center servers. so I want to run a bash script in PHP. Please find my php coding below
<?php
if(isset($_POST['bashbutton'])){
$ip="10.28.45.18";
$st="6W8WY42";
$output = shell_exec("sh ./Scripts/stbash.sh $ip $st");
echo $output;
}
?>
if the script is simple bash script like below, it is working.
hostip=$1
st=$2
echo $hostip $st
But my actual bash script is attached below. If i ran this, i am not getting any output on browser.
hostip=$1
cmd='racadm getsvctag'
st=$2
out=`sshpass -p 'calvin' ssh -o StrictHostKeyChecking=no root@$hostip "$cmd"`
echo $out
Kindly suggest me how to get the output for my actual script.