ssh - How to automating Putty Shell task on Windows 7?

24
2014-04
  • Arthur Wulf White

    I am interested in connecting by shell (Putty or another tool) (I have cygwin and OpenSSH ) This is what I wish to accomplish:

    1. Upload some files by scp (from Windows 7)
    2. Connect to the remote server
    3. ssh from that server to another remote server
    4. Run scripts (the files I uploaded earlier) and wait for them to finish.
    5. Download the files the scripts generated from the system.

    Here is what I have:

    1. I have the folders where all the files will be both on the local machine and the remote server.
    2. I know how long the scripts will take to run.
    3. I can approximate the time it will take to upload and download the files(they are very small).

    Is there any way to accomplish this?

  • Answers
  • boot13

    WinSCP supports command-line use. WinSCP scripting allows you to automate a connection to a remote server, as well as uploading files to the remote server via SCP. You can run a script on the remote server with WinSCP using the CALL command, then download the results, also using WinSCP. Here's a link to the WinSCP scripting and automation page: http://winscp.net/eng/docs/scripting.


  • Related Question

    ubuntu - Sending mail from the command line, in an automated way
  • jfmessier

    I want to be able to send a text file through an SMTP server of my ISP (port 25) to an email address on the internet, like my Office email address, or my GMail address. I have a basic Ubuntu 9.04 server setup on my DSL connection.

    How can I use, say, Postfix, to send the .LOG file, on a bash script ? What would be the packages to install on that server, given it was never used to send email in the past ?

    Thanks :-)


  • Related Answers
  • dertoni

    SendEmail seems like a nice tool for that. From what I get from the documentation it would be just a call like this:

    sendEmail -f <myadress> -t <destination> -u <subject> -m <message> -a <pathtofile> -s <serveradress> -xu <username> -xp <password>
    
  • innaM

    Another option is the ssmtp package. Since it's a sendmail emulator, it is highly compatible with all kinds of stuff that might want to send email.