1

I have an rsync script that runs on one Linux server to synchronize files with another Linux server. Is there a way to launch a script on one of the Linux machines without actually opening an interactive ssh session to the server?

4 Answers 4

4

You should do it via a SSH command. You just need to setup plink.exe . You can download it at:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Then, from a batch file like this one, exectute it:

@ECHO off
:: run remote command
plink.exe username@myserver /cygwin/C/Users/username/do-backup.sh
ECHO Remote command finished...
PAUSE>nul
0

If you have a shell script, then consider Cywgin. It takes a while to install, but you get a full suite of common Linux tools running on Windows, so you won't have to change your script at all.

3
  • but I'm looking to make a batch file or something like that, that will login into my linux bux and run that script... so it is possible by using Cywgin?
    – Kashif
    Apr 24, 2012 at 20:30
  • Yes. Bash in Cygwin is nearly the same as bash under any *nix.
    – Tim
    Apr 24, 2012 at 20:31
  • Cygwin is quite complete, so you will also have all the other scripting languages available, Python, Ruby, Perl, etc.
    – Tim
    Apr 24, 2012 at 20:32
0

If you want to automate a task, you might consider plink. It actually uses ssh (or telnet or raw) to connect to another machine. But you can use it to connect and run a command in one line. Check putty documentation for more details:

http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html

2
  • actually I'm not looking to automate this command. I'm looking to make it manual but then it should automatically login to server and run script. Actually I need rsync on different times so i want to keep it under my control to get rsycn whenever i want without going to server.
    – Kashif
    Apr 24, 2012 at 20:39
  • Then you just need to put it the line in a batch script as djangofan wrote and run the script when needed.
    – dmars
    Apr 24, 2012 at 20:42
0

I understand that you have a pre-written script, but maybe you can get everything you need done with one of the many "rsync for cygwin repackages" like cwrsync and setting up a Windows scheduling job using cwrsync.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .