I want to ssh to another server and run some scripts there. This is supposed to be a portion of another script that runs on local server. Is it possible to start a new terminal session to run the portion where I ssh to the remote server?
Welcome @Sourav_Rajeev
Yes, but your question is not very clear. One can run it as follows:
ssh user@server
/path/to/script
OR
ssh user@server /path/to/script
Is that what you want? If /path/to/script is on local system, you need to add ssh command as follows in script it self:
#!/bin/bash
echo "Starting local script"
date
echo "Login and running command on remote box"
ssh user@remote-box << 'EOF'
command1-to-run-on-remote-box
command2-to-run-on-remote-box
EOF
HTH
I want to run
ssh user@remote-box << ‘EOF’
command1-to-run-on-remote-box
command2-to-run-on-remote-box
EOF
on a separate terminal.
Is that possible?
What do you mean by a separate terminal? Like start a new terminal from script and run commands?
Yes. Is that possible?
The only way to do is as follows. The syntax to open new genome terminal
gnome-terminal -e command
gnome-terminal -e /path/to/your/ssh-script
In /path/to/your/ssh-script add your ssh command:
#!/bin/bash
ssh user@remote-box << ‘EOF’
command1-to-run-on-remote-box
command2-to-run-on-remote-box
EOF
Okay. Thankyou so much
I can also recommend looking into either screen tmux, that might also do what you want