0

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.

sandeepKumar
  • 771
  • 2
  • 12
  • 33

2 Answers2

1

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?

Community
  • 1
  • 1
Kiran Kumar
  • 1,033
  • 7
  • 20
1
/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 ) & )"'
sameerkn
  • 2,209
  • 1
  • 12
  • 13