Tuesday, January 25, 2011

running remote debian bash file from windows bat file

hi, i have two machines:
1) windows xp prof., where i have a Exec.bat which takes one parameter
2) debian machine, where i have a Run.sh which also takes one parameter

Now, currently i am switching between machines and doing the following:
Run.sh 1
Exec.bat 1
Run.sh 2
Exec.bat 2
...

My question is how is it possible to run the Run.sh which takes one argument from inside the Exec.bat, or otherway would also be good as a solution. thanks!

  • more info needed.

    what do the scripts do ? consider implementing the windows script on linux.

    From frisbee23
  • Install an ssh server on one machine and a client on the other machine. It's easier to set up the server on Linux (just install the ssh server package) and the client on Windows (you can install putty, or a port of unix utilities such as Cygwin). Set up public key authentication so you can log in through ssh without having to type a password each time (the putty manual, or any of a zillion tutorials on the web, explain how).

    Then run your commands from a batch file as follows:

    ssh linux.example.com run.sh 1
    call exec.bat 1
    ...
    

    Another possibility is Winexe.

    From Gilles
  • Take a look at Plink, from the makers of PuTTY. It is used for automated operations such as running commands through scripts like this. I use it frequently to write scripts, it is very straightforward:

    C:\>plink
    PuTTY Link: command-line connection utility
    Release 0.58
    Usage: plink [options] [user@]host [command]
           ("host" can also be a PuTTY saved session name)
    Options:
      -V        print version information and exit
      -pgpfp    print PGP key fingerprints and exit
      -v        show verbose messages
      -load sessname  Load settings from saved session
      -ssh -telnet -rlogin -raw
                force use of a particular protocol
      -P port   connect to specified port
      -l user   connect with specified username
      -batch    disable all interactive prompts
    The following options only apply to SSH connections:
      -pw passw login with specified password
      -D [listen-IP:]listen-port
                Dynamic SOCKS-based port forwarding
      -L [listen-IP:]listen-port:host:port
                Forward local port to remote address
      -R [listen-IP:]listen-port:host:port
                Forward remote port to local address
      -X -x     enable / disable X11 forwarding
      -A -a     enable / disable agent forwarding
      -t -T     enable / disable pty allocation
      -1 -2     force use of particular protocol version
      -4 -6     force use of IPv4 or IPv6
      -C        enable compression
      -i key    private key file for authentication
      -m file   read remote command(s) from file
      -s        remote command is an SSH subsystem (SSH-2 only)
      -N        don't start a shell/command (SSH-2 only)
    From RHELAdmin

0 comments:

Post a Comment