Solved

Batch File for Builds

Posted on 2012-04-03
6
478 Views
Last Modified: 2012-04-04
Greetings...
I am attempting to automate my build process (I am new to this).
I control the build on Windows, and the actions are done on Linux.

I would like to be on a windows machine and do the following:
1. Move a file from Windows to Linux Server via SCP
2. Execute commands on Linux Server (the command in question is istools.sh, but I want to be general in case I need to do other things).

If I can write a BAT file that can do this? or a Powershell bat, perhaps?

Looking for ideas...
Thanks.
0
Comment
Question by:Evan Cutler
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:ZShaver
Comment Utility
you cannot do this without external utilities available to the system

you will need an SCP client for windows that supports command line functions, as well as an telnet/SSH client that supports command line functions like what you have defined

I would personally instead script this using PHP as it already contains the functionality you need to do all this, and you can make a nice web based interface for it also.
0
 
LVL 3

Assisted Solution

by:telczj9
telczj9 earned 500 total points
Comment Utility
Yes, you will need external utilities available to your windows system.  These two utilities:

PSCP (an SCP client, i.e. command-line secure file copy)
Plink (a command-line interface to the PuTTY back ends)

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

tied in with batch scripts allow me to orchestrate an amazing work flow against 100 plus hosts (linux\unix).

Cheers!
0
 
LVL 9

Author Comment

by:Evan Cutler
Comment Utility
You are awesome telczj9...
any chance on visualizing some of your code?

thanks
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Assisted Solution

by:telczj9
telczj9 earned 500 total points
Comment Utility
Arcee123,

it will be easier to start with the specific questions on this post:

1. Move a file from Windows to Linux Server via SCP
pscp -l <user_id> -pw <password>  <source> <host_name>:<destination>

Open in new window


or  Move a file from Linux to Windows Server via SCP:
pscp -l <user_id> -pw <password>  <host_name>:<source> <destination>

Open in new window


2. Execute commands on Linux Server (the command in question is istools.sh, but I want to be general in case I need to do other things).
PLINK <host_name> -l <user_id> -pw <password> -t <command>

Open in new window


in the event that that the shell script needs to be executed from directory it resides:
PLINK <host_name> -l <user_id> -pw <password> -t "cd /<dir_1>/<dir_2>/<dir_3> ; ./istools.sh 

Open in new window


Cheers!
0
 
LVL 3

Accepted Solution

by:
telczj9 earned 500 total points
Comment Utility
You don't have to put your password in clear test if you don't want, you can also plant public keys on the hosts you will be interacting.  In this manner there would be no need to use passwords.  Just hide you private key in your windows host behind permissions so others can not get to it.

Cheers!
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
Comment Utility
I wish I could put 500 in each of those blocks...
Thanks much.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now