These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Batch update Highly guessable Script Installer paths? on the new forum.
Say someone had used a really guessable dirname/path for installing a pretty important...oh, say, PHP database management script...
Is there a batch way to rename those directories over dozens of domains, in a Script Installer friendly way, i.e. to not break the upgrade capability?
Thanks.
Howdy,
Well, there's none that exists today. Though it wouldn't likely take much work to create one.
The key is that if you change the path to your, err, PHP database management script, you'd want to update the config file that Virtualmin has with that info in it.
Virtualmin keeps that information in /etc/webmin/virtual-server/scriptlog/$DOMAIN_ID/*.script.
As long as you keep the Virtualmin config file in sync with the actual path, you should be in good shape and Virtualmin should be able to continue updating your app.
-Eric
So, just replace all the occurrences of that string within that scriptlog folder (-R), then rename all the directories where the app is installed to match? That doesn't sound too bad, indeed.
Yeah, so the config file for the, um, PHP database management script, will look something like this:
pass=
version=3.3.3
name=phpdatabaseadmintool
opts_phpver=5
opts_path=/phpdatabaseadmintool
opts_db=
opts_dir=/home/USERNAME/public_html/phpdatabaseadmintool
partial=
opts_auto=0
desc=Under public_html/phpdatabaseadmintool
url=http://domain.tld/phpdatabaseadmintool/
user=
id=127847796915451
It looks like there's 5 occurrences of the name "phpdatabaseadmintool" in there... you'd want to update all but the first one (which is just the name).
Before batch updating everything, you probably want to make the change to just one and make sure it looks okay in Virtualmin.
Also, be sure to create a backup of all your config files before making lots of changes like that :-)
-Eric
So, I need to loop through the directories in /etc/webmin/virtual-server/scriptlog, identify the files that contain the offending word, and if not in the name= line, replace it with a stealthier folder name.
Since this is probably short work for someone out there, I'll offer a $20 PayPal bounty, and donate the script back to Virtualmin, if Jamie is interested.
Best, Ken
Maybe one of you brainiacs can document this for me :)
Compliments of my technology angel, Liz at Rimuhosting, a standout among a pretty solid bunch of geeks:
To be run from within the scripts directory, I would guess-
grep -r "opts_path=/phpmyadmin" /.script | sed s/:.*// | while read line ; do phpath=$(grep opts_dir $line | cut -c10-) ; newphpath=$(echo $phpath |sed s/phpmyadmin/phpdatabasethingy/) ;mv "$phpath" "$newphpath" ; sed -i s/phpmyadmin/phpdatabaseadmintool/ "$line" ; sed -i s/name=phpdatabaseadminthingy/name=phpmyadmin/ "$line"; done
You see the logic at the end to skip the name= line, which is the human recognizable label
Enjoy!
I think there is a lost backslash before the : in the first sed. Possibly eaten by the forum.
Because the forum may have munged the paste I did above, here's a link to the script:
http://nextwavetech.us/site/vmin-apps-renamer.txt