tags:

views:

68

answers:

4

I do these jobs every day manually with a GUI client:

  1. upload data(.tar.gz) to remote server(linux) via ssh,which takes about an hour.
  2. uncompress the data and run update.sh

How can I automate the process so that I don't need to wait an hour?

My PC OS is windows.

How to do the above jobs by commandline?

+3  A: 

Use the task scheduler built into Windows to get the data to the server.

http://technet.microsoft.com/en-us/library/bb726974.aspx
http://kb.helpdeskpilot.com/knowledgebase.php?act=art&article_id=67
selbie
A: 

You can do everything that you want with vbscript since you are on a Windows PC. Look into using .hta with vbscript.

John
A: 

This sounds like the perfect job for a batch file. A batch file is simply a list of commands to be executed by the Windows shell (cmd.exe). Once you find and install a Windows ssh client with a command-line interface (PuTTY is one possible option), simply type the commands you would use to perform your task into a text file with the extension .bat and run the batch file. See this cmd.exe tutorial for more information on the Windows shell and this batch file guide once you're comfortable on the command line. Batch files are a great way to automate tedious tasks.

Evan Kroske
A: 

Have the Linux server fetch the data, e. g. using wget. Then write a shell script that executes wget (or whatever you used to fetch the file) and then calls your update script (should be three lines). Finally create a cron job to execute the script.

It might be a bit more work than a Windoze-only-Automation, but the big advantage is that if you PC goes AWOL, the process will continue running...

vwegert
Aren't you assuming that his Windows box is already running a web server (with authentication and encryption set up), or that the data is coming from an external website?
Ken
@Ken: Since user198729 never told us where he go the .tar.gz from, I just mentioned wget as an example of a program that can fetch files from FTP servers or HTTP(s) sites. If it's coming from a different source, just use a different tool.
vwegert
He didn't say it was coming *from* anywhere -- as far as we can tell, it's originating on the Windows box (or "Windoze", if you must), for which typically FTP and HTTP servers (and often anything else at all) aren't set up.
Ken