[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 491
  • Last Modified:

Batch File for Builds

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
Evan Cutler
Asked:
Evan Cutler
  • 3
  • 2
3 Solutions
 
ZShaverCommented:
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
 
telczj9Commented:
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
 
Evan CutlerAuthor Commented:
You are awesome telczj9...
any chance on visualizing some of your code?

thanks
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
telczj9Commented:
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
 
telczj9Commented:
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
 
Evan CutlerAuthor Commented:
I wish I could put 500 in each of those blocks...
Thanks much.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now