Introduction
Push2Linux
is a deploy tool or rather a mass deploy tool. Consider attempting to deploy a
piece of software across 500 Unix/Linux devices and the possible time involved
doing it manually. This is where Push2Linux comes in – it tries to simplify the
process by managing the deploy of the code for you. This is also a very handy tool for a developer especially in testing.
Features
- Deploy software across a single or a large subset of
hosts
- Execute commands remotely across multiple unixes
devices from one location
- Execute a script remotely across multiple unix devices
- Customize installation to fit your needs with a bash shell script
- Restart Services of multiple hosts
<o:p>
How it works?
Let’s
try understand how we can leverage Push2Linux by looking at various scenarios:<o:p>
Scenario
1: Execute Command Across A Host<o:p>
Assume
we have Web Server and we need to
restart the ‘Apache Web Service’ on it. In Diagram A below, you can just add in
the host name, username and password and then the exact command you would like
to execute. In this case we will issue a service restart for Apache.
[Diagram A]
Scenario
2: Execute Command Across Multiple Hosts
Firstly
you going to need to create a CSV file to be used as the configuration file
(input). The format is displayed below, <o:p>
<ip/hostname>,
<username>, <password>

[Diagram B]
Let’s
say I wanted to get the log file for multiple devices and have the log emailed
to my address, using this handy one-liner and Push2Linux, this is no problem.
echo
"This is the message body" | mutt -a file.to.attach -s "subject
of message" recipient@domain.com

[Diagram C]
Just click - Deploy and you done!
Scenario
3: Install and setup Software on Multiple Hosts
In
the third scenario, let us assume we have some custom software we have written
in Java or Ruby and we would like to deploy it across a mass of hosts. We
obviously create our CSV file, adding in the devices and their authentication
details. <o:p>
Following
along with Diagram D, we tick the ‘Use Zipped Archive’ checkbox. That will
provide you with the following options:
- Archive: a zip compressed file (no spaces in name)
containing the files or software you would like to deploy. PS. This needs to
include the setup script for your planned installation, in this case it’s
called setup.sh.
- Copy to Archive: is the remote location to which the
files will be copied on the remote host and from where you will commence to
execute your setup script.
- Checkbox Unzip: This is used if the file you are
attaching is Zip compressed
- Checkbox Script: This is important to take note off. If
this is unticked that means the file attached is just a script (a bash script)
which Push2Linux will SCP across, and then execute using the Command Option
with full path.
<o:p>

[Diagram D]
Lastly the Command Option below is the full path the
script file you would like to execute.
Points of Interest
This is the basics of Push2Linux, a mass deploy tool. I’ve
also built in asynchronous call back to kill connections when they are taking
too long. I noticed on some larger deployments that SCP/SSH on certain machines
hang or never return. Though rare, the Push2Linux should take care of this.
Attached is full source code with Project File, including Installer.
Requirements for Remote Hosts:
- Dos2Unix - used to convert scripts to unix format
unless control characters from windows will break script execution
- Unzip/Zip