Msg#: 3847395 posted 6:43 pm on Feb 11, 2009 (gmt 0)
We've gotten to a point where we have a ton of customers using Wordpress, and we want to make sure they're all up to date without having to login to each backend to see what version's running.
I can easily run
locate /wp-includes/version.php to get a list of all the sites that have Wordpress installed.
What I really want to do is find the actual domain name and the version of Wordpress being run so I know which sites need an upgrade.
Forgive me if I'm being dense about this, but here goes.
What I have now is a text file that looks like this. ... site3 site34 site35 site37 ...
I want to run through that list and grep that sitenum from the /etc/virtualhosting/mappings/domainmap so I can get the actual domain names. What's happening to me though, is that when the shell script greps for "site3" it's also finding site31, site32, site33 and so on.
My shell script is very simple and isn't at all accomplishing what I intended. I know there's a better way to do it, but I'm not a programmer!
This is what I have now:
for i in `cat sitenums`; do grep -F $i /etc/virtualhosting/mappings/domainmap; done
And the result is that almost every domain name is being displayed for the reason I gave above.
Does anyone have a better idea about how I should do this?
Msg#: 3847395 posted 12:50 am on Feb 24, 2009 (gmt 0)
I've never used Parallels pro and I'm unsure what the exact format of the /etc/virtualhosting/mappings/domainmap is but the following may work:
for i in `cat sitenums`; do grep $i[^0-9] /etc/virtualhosting/mappings/domainmap; done
The $i[^0-9] should match any line that contains the output of the sitenums file not followed by a number.
I've run a test and it seems to work: [root@TEST htdocs]$ cat test2.txt site3 [root@TEST htdocs]$ cat test3.txt site3 alpha site31 beta site32 charle site33 delta [root@TEST htdocs]$ cat shell.txt for i in `cat test2.txt`; do grep $i[^0-9] test3.txt; done [root@TEST htdocs]$ ./shell.txt site3 alpha