Reputation: 811
I hardly know anything about shell script or terminal commands.
Want to achieve:
Make a shell script, that connects to remote server and after connecting to that server, run some commands on that server.
Is it possible?
I have tried googling, but didn't find something, i am looking for.
Upvotes: 0
Views: 2311
Reputation: 2259
/tmp/sh.sh is shell script on remote server.
#!/bin/bash
ssh "root@server-ip" 'sh -c "( (nohup /tmp/sh.sh) )"'
#use following for suppressing the output from remote server script.
ssh "root@server-ip" 'sh -c "( (nohup /tmp/sh.sh &>/dev/null ) & )"'
Upvotes: 1
Reputation: 1051
You can do this using ssh (secure shell), you can refer this question for answers How to use SSH to run a shell script on a remote machine?
Upvotes: 1