php - phpseclib SSH - Change directory and run script? -
i have script in /home/pi/mydir want execute first thing need
$ssh->exec('cd mydir'); and then
$ssh->exec('./script'); but it's not working can me?
use \n :
$ssh->exec("cd mydir\n./script"); or create file script.sh (example) , save in unix format:
cd mydir ./script and exec script:
$script = file_get_contents("script.sh"); $ssh->exec($script);
Comments
Post a Comment