vendredi 10 septembre 2021

SSH into dynamic remote server and run a command - Laravel 5.8

I'm using L 5.8 and I have a form with 3 inputs

enter image description here

Right now, I can SSH into a specific server with this package laravelcollective/remote": "~5.8. I required to pre configured IP, UN, PW in the config/remote.php like so :

'connections' => [
    'production' => [
        'host'      => '1.1.1.1',
        'username'  => 'code',
        'password'  => '8888',
        'key'       => '',
        'keytext'   => '',
        'keyphrase' => '',
        'agent'     => '',
        'timeout'   => 10,
    ],
],

Then, I can easily run any command(s) or even chain them

$commands = ['cd /home/code && ./runMe.sh'];
SSH::run($commands, function($line)
{
    echo $line.PHP_EOL;
});

Result

My portal will connect to that server and run that command successfully, and I've verified it.


Now

I need to read it from form inputs. Is it possible to use the same plugin and dynamically setting that file remote.php ?

or

Should I start looking into something else because this is a dead end ?

Please advise,



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2XcJswo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire