Execute commands in remote server



  • Hi!

    I may be having a baaaddd day or I simply couldn't figure out a way to execute commands in a remote server.

    I created a Command widget and added several Command Lines, being the first one the ssh connection to my server.

    What Freeter does is execute the first one and then it doesn't execute the next ones. What am I missing?

    Thanks!



  • Ok, it was a bad day simply. I just created a bash script in my local machine and I´m executing it.



  • @victorgonal Thanks for posting the solution :) Could you share the command lines you tried to execute via Commander? It should execute all command lines from the list. However, for advanced scenarios it's definitely recommended to turn them into bash/batch script file and execute with a single line in Commander.



  • Hi @alexk

    I tried the following

    ssh -i /path/to/pem/file.pem -t [email protected]_ADDRESS_OF_MY_SERVER
    service httpd restart
    sleep 2
    exit

    As it didn't work I created the bash file with:

    #!/bin/bash -p
    TERM=linux
    export TERM
    echo 'Connecting to remote server'
    ssh -i /path/to/pem/file.pem -t [email protected]_ADDRESS_OF_MY_SERVER
    'sudo service httpd restart && sleep 2 && exit'
    exit

    chmod +x it and then just simply call it from Freeter



  • @victorgonal Thank you for posting the command lines here. I'll research what was wrong with the direct execution of them.


Log in to reply
 

Looks like your connection to Freeter Forum was lost, please wait while we try to reconnect.