Thursday, May 3, 2012

HowTo: Execute A Script On Remote UNIX / Linux Server

How do I execute a script on remote server called server2.example.com from my PC?

You can use ssh client (part of most UNIX / BSD / OS X and Linux distros) as follows to run any command or script on remote UNIX or Linux server as follows:
ssh user@server2.example.com script.name
You can execute the date command as follows on remote server:
ssh user@server2.example.com date
You may need to specify full script path. In this example, run /root/backup.sh script as follows:
ssh user@server2.example.com /root/backup.sh

No comments:

Post a Comment