?
Solved

Batch File for Builds

Posted on 2012-04-03
6
Medium Priority
?
488 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:ZShaver
ID: 37802650
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 2000 total points
ID: 37804128
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
ID: 37804226
You are awesome telczj9...
any chance on visualizing some of your code?

thanks
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 3

Assisted Solution

by:telczj9
telczj9 earned 2000 total points
ID: 37804601
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 2000 total points
ID: 37804608
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
ID: 37805918
I wish I could put 500 in each of those blocks...
Thanks much.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 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