Determining what versions of WordPress you are hosting

August 10, 2010

If you host lots of different sites for people, one of the things you might want to know is what versions of WordPress each site is running.

WordPress stores the version number in a variable named $wp_version which is set in the file version.php.

With that information in hand, you can write a bash command that you run from your /home directory to display all of the WordPress versions you have on your server:

find . -name version.php -type f|xargs grep ^\$wp_version

This is one of the aliases I have in my .bashrc file.

Three helpful additions to your .bashrc

June 21, 2010

I just made a change to my .bashrc file and I thought I would share the tip. All of this is pretty basic stuff, but if you don’t customize your linux logins, this would be a good place to start.

For Microsoft people who don’t know, .bashrc is in some ways like a combined config.sys and autoexec.bat file. If you don’t know what an autoexec.bat file is, you totally missed the 80s dudes…

In a *nix environment, the rc at the end of a file name typically means that it is a “run control” file. Run Control files execute when a program starts. In this case, the program is bash – the command line interpreter/shell. Other programs look for rc files too. Because of this, you could have bunches of them in your home directory. The . at the front of the file name indicates that they are hidden from a normal directory listing. This way they don’t clutter up your home.

I have lots of neat things in my .bashrc file that add functionality to my default CLI. I’ll be sharing just three of those with you now.

The first is an alias: ebrc. When I type ebrc and press enter, I’m taken immediately into an editor with my .bashrc file open. You can think of an alias as a single line shortcut. It looks like this:

alias ebrc='vi ~/.bashrc'

As you can see, it just says “when I type ‘ebrc’, treat it like I really typed ‘vi ~/.bashrc’”.

The second thing I used tonight was the alias brc:

alias brc='. ~/.bashrc'

That executes the .bashrc file again, so that all of the changes I’d just made are loaded.

You might ask “Can’t you just type all that out? You’re not saving much time.” Go ahead.. ask. I’ll wait…

OK. The answer is Yes. So, it is important that you don’t go overboard on this stuff. If you use aliases too much, you’ll lose your familiarity with *nix and the skills to do your work on any other server. So proceed with caution. This stuff can be addictive and detrimental to your guru health.

Now with those two helper aliases in hand, I added the function I really wanted to include: ‘upskel’. It takes a task I might otherwise put off and allows it to be completed in 7 keypresses. This is the perfect use case for a .bashrc function.

‘upskel’ takes the latest version of WordPress and places it into the cpanel skeleton directory that is used as the base for every new account created on my hosting service eHermits, Inc.. So, every time an update comes out for WordPress, I can spend 5 seconds to grab the latest and all new accounts I create will be safe and updated.

Unlike an alias, this is done through a function call. Functions allow the use of multiple lines and variables. Here is the call I just added:

function upskel()
{
  cd /root/cpanel3-skel
  rm -R public_html
  rm latest.zip*
  wget http://wordpress.org/latest.zip
  unzip latest.zip
  mv wordpress public_html
}

Technically I probably could have done that as an alias but a function is much easier to read with multiple lines involved.

As a bonus, here is a function that takes a variable:

function  ewpc()
{
  cd /home/$1*/
  pwd
  sudo vi ./public_html/wp-config.php
}

Can you tell me what it does?

Using find to copy specific files on linux

June 2, 2010

I was faced with a weird copy command I wanted to do today; so I thought I would share.

How do you copy files in a directory tree to another directory?

I wanted to copy all of the mp3 files in a directory tree over to one specific target directory.

Initially I thought the command

cp -r *.mp3 /target/directory/

would work, but  even though it specifies the –recursive option, it does not iterate the subdirectory looking for the mp3 files.

So I resorted to my  every faithful companion: find -exec.  It seems like this is one of the most useful tools in linux.  In this case, here is the command line I used:

find . -type f -name ‘*.mp3′ -exec cp {} /targetdirectory/ \;

How to: Find files edited in the last day

February 15, 2010

The process is straight forwarded. There are several methods:

find . -mtime -1 \! -type d -exec ls -l {} \;

Or more simply

find . -type f -mtime -1

In my case, I wanted to do more. First since I was searching an SVN repository, I wasted to exclude all of the extra files that are touched by SVN. Additionally, the goal was to show which files contained a print_r function.

Here’s what I came up with:

find . -path '*/.svn/*' -prune -o -type f -mtime -1 \
-exec echo '{}' \; -exec grep print_r {} \;

Hope that helps!

Getting the error ‘cannot move – to a subdirectory of itself’?

August 19, 2009

This error message always bothered me because it makes no sense when I get it.

Here’s my scenario… I have a directory that is used as the base for all new accounts I sell on my servers. The path is; /root/cpanel3-skel. I always put WordPress in that directory and I want to keep the latest version of WP in that directory

[root@wiredtree ~]# rm -r wordpress latest.*
rm: cannot remove `wordpress’: No such file or directory
rm: cannot remove `latest.*’: No such file or directory
[root@wiredtree ~]# wget -q http://wordpress.org/latest.zip
[root@wiredtree ~]# unzip -q latest.zip
[root@wiredtree ~]# mv -f wordpress/* /root/cpanel3-skel/public_html/
mv: cannot move `wordpress/wp-admin’ to a subdirectory of itself, `/root/cpanel3-skel/public_html/wp-admin’
mv: cannot move `wordpress/wp-content’ to a subdirectory of itself, `/root/cpanel3-skel/public_html/wp-content’
mv: cannot move `wordpress/wp-includes’ to a subdirectory of itself, `/root/cpanel3-skel/public_html/wp-includes’

WHAAAAT? Obviously it is not a subdirectory of itself…

Something strange is going on… We get a little more information if we try to do a move from one device to another. Take a look at this error message:

[root@wiredtree tmp]# mv -f wordpress/* /root/cpanel3-skel/public_html/
mv: inter-device move failed: `wordpress/wp-admin’ to `/root/cpanel3-skel/public_html/wp-admin’; unable to remove target: Is a directory
mv: inter-device move failed: `wordpress/wp-content’ to `/root/cpanel3-skel/public_html/wp-content’; unable to remove target: Is a directory
mv: inter-device move failed: `wordpress/wp-includes’ to `/root/cpanel3-skel/public_html/wp-includes’; unable to remove target: Is a directory

This reveals the true source of the error message. In “mv –help”, the explanation of “-f” is too simplified and says only:

-f, –force do not prompt before overwriting

In “cp –h” we closer,but not exact, explanation of the real process, and one that better matches the inter-device error message:

-f, –force if an existing destination file cannot be opened, remove it and try again

The final bit of information is in an Ubunto bug 71174 “Misleading error message with mv and existing directories” where they change the error message to be “mv: cannot move `a’ to `b/a’: Directory not empty”.

So there you have it. You get that error message because the -f command tries first to remove the directory and can’t because it contains one or more files. You don’t get this message if the subdirectories are empty. The remove works fine on an empty directory but fails if there are files. The Linux core can’t correctly handle this exception and throws up what is probably the last error message in a switch/case statement “cannot move – to a subdirectory of itself”.

So what do you do about it? Well you can either empty the destination directory first, or you can copy the files and then delete the source directory. I chose the latter option and run this from the root folder:

rm -r wordpress latest.*
wget -q http://wordpress.org/latest.zip
unzip -q latest.zip
cp -rf wordpress/* cpanel3-skel/public_html/
rm -r wordpress latest.*

Cool? Hope that helps someone…

Microsoft: I just stepped into what?

July 6, 2007

Microsoft scrambles quickly backwards away from a GPLv3 and checks its loafers to see exactly what it just put its $500 loafers into…  Still “As always, Microsoft remains committed to working with the open source software community”.

Microsoft Statement About GPLv3

A Microsoft statement about GPLv3.

Published: July 5, 2007

Microsoft is not a party to the GPLv3 license and none of its actions are to be misinterpreted as accepting status as a contracting party of GPLv3 or assuming any legal obligations under such license.

While there have been some claims that Microsoft’s distribution of certificates for Novell support services, under our interoperability collaboration with Novell, constitutes acceptance of the GPLv3 license, we do not believe that such claims have a valid legal basis under contract, intellectual property, or any other law. In fact, we do not believe that Microsoft needs a license under GPL to carry out any aspect of its collaboration with Novell, including its distribution of support certificates, even if Novell chooses to distribute GPLv3 code in the future. Furthermore, Microsoft does not grant any implied or express patent rights under or as a result of GPLv3, and GPLv3 licensors have no authority to represent or bind Microsoft in any way.

At this point in time, in order to avoid any doubt or legal debate on this issue, Microsoft has decided that the Novell support certificates that we distribute to customers will not entitle the recipient to receive from Novell, or any other party, any subscription for support and updates relating to any code licensed under GPLv3. We will closely study the situation and decide whether to expand the scope of the certificates in the future.

As always, Microsoft remains committed to working with the open source software community to help improve interoperability for customers working in mixed source environments and deliver IP assurance. Our partnerships with Novell and other Linux platform and desktop providers remain strong and the IP bridge we built with them, embodied in our collaboration agreements, remains intact. In particular, our technical and business collaboration with Novell continues to move full steam ahead, including our joint development work on virtualization, standards-based systems management, identity interoperability and document format translators. In addition, the patent covenants offered by Microsoft and Novell to each other’s customers are unchanged, and will continue to apply in the same way they did previously.

Notes on Microsoft/Novell Anouncement: SUSE Linux/Windows Interoperablity

November 2, 2006

(Article Draft – Corrections will be made to spelling and grammar – These views are mine coming as fast as I can type with the live announcement. I apologies for any typos/misquotes/misinterpretations.)

Microsoft and Novell made an abrupt disclosure via their web cast site that there would be a VERY IMPORTANT announcement. That announcement occurred at 2:19pm PST/5:19pmEST. This announcement is important to large scale Enterprise and Server/datacenter operators as well as the developer community. It offers more choices, opportunties and technologies to IT operators around the world.

You may view the WebCast session in its entirety using any with these links:

Please, as you listen to the session, if I can enhance or correct any of my notes, please let me know in a comment on this post.
Read more

BIG LIVE Microsoft/Novell/Linux? announcement RIGHT NOW

November 2, 2006

Bridging the devide between Closed/OpenSource and Linux/Windows

It will last till 2:49pm GO THERE NOW!!!!!!

It started 2:19pm EST
Steve Ballmer to Deliver Industry Announcement

November 2, 2006

Microsoft Corp. CEO Steve Ballmer will deliver an announcement during a press conference today, Thurs., Nov. 2, in San Francisco beginning at 2 p.m. Pacific time / 5 p.m. Eastern time. Details of the announcement will be provided during the press conference.

http://www.microsoft.com/events/executives/webcasts.mspx

Who is Brian Layman

I am a WordPress expert living in North East Ohio. I am part of the ever expanding Open Source Internet workforce. I am able to stay at home, with my wife and four home schooled kids, while working as the Senior Developer for b5media - a blogging network that has hosted over 300+

I co-host the NEO WordPress Monthly meetup. I am the board chair of our local church. I host and have provided development services for clients such TV personalities Rhett and Link as well as corporations such as Borland International.

In my spare time I try to sneak out, canoe, mountain bike and camp as often as I can. Sometimes I also defend the earth against zombies and aliens, but usually not during the camping trips.

Services Provided

In providing hosting, email, theme and plugin development to my clients, I function as a single point of contact answering to the needs of their expanding sites.

My service portfolio includes but is not limited to WordPress hosting, optimization, theme development and custom plugin creation. Community creation via vBulletin, Ning and BuddyPress and bbpress

I also am well experienced in site conversion, transition and merges. To clarify this, website technologies change and giving up your data is not an option. I have transitioned literally hundreds of sites from one platform to another.

viagra 50 mg indian version of viagra cialis cheapest viagra india online viagra cost comparison viagra for sale without prescription generic tadalafil online buy viagra in korea indian levitra discount cialis online viagra prescription over the counter vardenafil cialis otc cialis no rx cialis 30 mg viagra ranbaxy buy levitra in uk cialis low price tadalafil tablets 10mg cheap viagra fast shipping cheap generic levitra cialis discount cialis 5mg viagra discount prices buy levitra without prescription vardenafil online generic levitra canada viagra professional price cheapest sildenafil citrate indian version of cialis viagra lowest price viagra online prescriptions tadalafil 10mg levitra over the counter levitra prescriptions online buy viagra without a prescription liquid tadalafil citrate buy viagra prescription online tadalafil 20mg india india viagra generic sildenafil citrate for sale vardenafil hcl 10mg cialis discount coupon buy levitra australia viagra over the counter in canada liquid sildenafil tadalafil price comparison viagra cost in india cialis mail order sildenafil sales buy vardenafil cialis offer cheap vardenafil generic cialis no prescription viagra tabs generic indian names viagra price canada vardenafil hcl 20 mg generic viagra without prescription viagra by scilla biotechnologies buy generic cialis free viagra viagra over the counter viagra pills kamagra 100 mg cialis from india tadalafil australia tadalafil 20mg tablets tadalafil soft tabs sildenafil pills viagra no prescription required generic viagra paypal tadalafil online indian viagra cost tadalafil online pharmacy generic soft viagra sildenafil soft tablets viagra generic names buy viagra in ireland levitra without prescription levitra online purchase cialis pill indian tadalafil levitra 5mg cialis cost per pill tadalafil oral jelly sildenafil no prescription vardenafil price generic cialis 10mg cheap cialis no prescription order sildenafil citrate indian generic viagra blue viagra buy cialis usa apcalis 20mg tablets viagra overnight delivery sildenafil india purchase viagra without a prescription viagra prescriptions order viagra without prescription viagra with no prescription levitra for sale purchase viagra canada discount levitra viagra 200mg cheap viagra 100mg cialis overnight delivery buy sildenafil online viagra made in india cialis tabs 10mg viagra indian pharmacy viagra for sale in ireland viagra uk prices buy viagra in europe generic cialis india levitra online viagra for sale india buy viagra in dublin generic cialis soft tabs viagra 50mg cost generic sildenafil 100mg tadalafil generic viagra super active 100 mg kamagra 100mg sildenafil 100 mg tablets cialis no prescription viagra low price online cialis suhagra tablets buy cialis daily use tadalafil sample cialis prices viagra prescription online buy cialis pill kamagra from india cialis online levitra mg vigora india vardenafil 10 mg sildenafil citrate 100mg buy viagra in india buy cialis professional viagra in india buy viagra in singapore generic revatio viagra substitutes sildenafil canada viagra no script cheap kamagra viagra retail price cheap lovegra order viagra uk buy cialis in mexico viagra prescription price purchase cialis online without prescription online cialis prescription ranbaxy caverta buy viagra in hong kong sildenafil price cialis mastercard buy viagra in england viagra mail order canada cialis tablets for sale order cialis cialis soft tabs generic levitra india tadalafil prices cheap sildenafil citrate tablets cialis online prescriptions cialis 5 mg daily levitra prices prescriptions viagra viagra over the counter alternative cialis 20 mg tablets cialis generic india cialis prescribing cialis 20mg daily sildenafil 50 mg viagra drug prices tadalafil generic india cialis sale viagra prices buy viagra 50 mg levitra pharmacy buy viagra generic viagra prescription drug cialis daily cost vardenafil uk viagra soft tabs online buy viagra super active cialis 10mg price 25mg viagra silagra 100mg online viagra prescriptions cialis prescription cheap cialis india revatio 20 mg indian equivalent of viagra tadalafil india viagra capsules cheapest viagra buy cialis without prescription tadalafil overnight cheap tadalafil online purchase viagra online no prescription