tm2000
08-12-2006, 09:02 PM
There has got to be an easy way to do this.. I have 9 files (via a security update) that I need to copy to 37 domains...
How best to do this? I was thinking some kind of script, but I'm new to that..
Have /home/upgrade/public_html/ with all the files in the right structure
and need to copy to:
/home/site1/public_html/
/home/site2/public_html/
/home/site3/public_html/
...
/home/site37/public_html/
So I know I could do this 37 times via shell:
cp -r -f --reply=yes public_html /home/site1
cp -r -f --reply=yes public_html /home/site2
BUT SURELY THERE IS A BETTER WAY... How do you guys handle upgrades like this if the Client wants you to do them... for $$ of course :)
Tree NC
08-12-2006, 09:08 PM
#!/usr/bin/php
<?
$sites = array("site1",
"site2",
"site3");
foreach($sites as $key => $value)
{
exec("cp -r -f --reply=yes public_html /home/".$value);
echo $value." completed.<br>";
}
?>
Call that script from /home/upgrade/public_html/ and you should be fine. Make sure to backup before you do though.
tamasrepus
08-13-2006, 12:49 AM
BUT SURELY THERE IS A BETTER WAY... How do you guys handle upgrades like this if the Client wants you to do them... for $$ of course :)
If you think the answer to this deserves monetary compensation, why are we answering it for free?
Pseudocode for the bash version:
SITES="site1 site2 ... site32"
for site in $SITES; do
cp -r -f --reply=yes public_html /home/$site
Note that what you're doing is copying files over existing ones--you'll get clients angry if they had made any changes, because you've just erased them. A better way (and is what I do for the Drupal sites my company hosts) is to create a UNIX patch file, and patch all sites. Any failure in the patching process is obvious, and I can work with the client to alleviate the issue.
tm2000
08-13-2006, 09:16 AM
THANKS TO YOU BOTH!!!
Worked great! :)
Note that what you're doing is copying files over existing ones--you'll get clients angry if they had made any changes, because you've just erased them. A better way (and is what I do for the Drupal sites my company hosts) is to create a UNIX patch file, and patch all sites. Any failure in the patching process is obvious, and I can work with the client to alleviate the issue.
Yeah, I know what you mean. I stripped out any config files to be sure nothing was overwritten that was Client specific. This upgrade was all core files... but I do need to figure out that Patch command. I have used it and it was great.. just need to figure out how to create the patch files.
THANKS Again..