fixyourserver.com

A lot of stuff and things…

Deploy cPanel packages to multiple servers

This is a pretty nifty one I recently whipped up. You can alter this to deploy just about any files you want. such as httpd.conf, php.ini, exim.conf, or pictures of your dog to replace the dreaded apache page… (at least then clients wouldn’t be sooo pissed when they call or write you) Anywho….

#!/bin/bash
#  Deploy packages #
#  Rob.H 09.24.09  #

file="/var/cpanel/packages/*"
echo "Deploying new packages"
echo ""
for i in `cat servers.txt`; do rsync -avz $file -e ssh $i:/var/cpanel/packages/; done
echo ""
echo "deployed... now relax"

Now this is assuming you have files in /var/cpanel/packages/* and you want them all moved, this is replaceable. This is assuming that you have keys to all servers which makes a 5 hour job a sub-10minute job depending on the number of servers.

Note that I am cat’ing a servers.txt, you’ll want to make this file and put in a new IP or hostname on each line.

Hope this make your day shorter!
-Rob

Next Post

Previous Post

Leave a Reply

© 2017 fixyourserver.com

Theme by Anders Norén