• Just passed 70-662 : Microsoft Exchange Server 2010, Configuring

    Next up: 70-663


  • BASH script to email if WordPress plugins or themes need updating

    This one took me all day. But I got it. I wanted to have a script that could look through all WordPress sites and find if there are outdated themes or plugins. All I need to do is slap it into a cron job and I am good to go!

    Here is the BASH code to do it.

     

    UPDATESNEEDED=""
    
    for installpath in $(find /var/www -name wp-config.php)
    do
    cd $(dirname $installpath)
    
    THEMENEEDED=$(php -r 'require_once("./wp-load.php");
    delete_site_transient("update_themes");
    wp_update_themes();
    $new = get_site_transient("update_themes");
    echo count($new->response);')
    
    if [ ! $THEMENEEDED = 0 ]; then
    UPDATESNEEDED="$UPDATESNEEDED \n Site $installpath needs $THEMENEEDED theme(s) updated"
    fi
    
    PLUGSNEEDED=$(php -r 'require_once("./wp-load.php");
    delete_site_transient("update_plugins");
    wp_update_plugins();
    $new = get_site_transient("update_plugins");
    echo count($new->response);')
    
    if [ ! $PLUGSNEEDED = 0 ]; then
    UPDATESNEEDED="$UPDATESNEEDED \n Site $installpath needs $PLUGSNEEDED plugin(s) updated"
    fi
    done
    
    if [ -n "$UPDATESNEEDED" ]; then
    echo -e "$UPDATESNEEDED" | mail -s "Updates are needed" [email protected]
    fi
    

    I have been needing this script for a while.


  • 2000 visitors in 1 month. Nice!

    20110801-084219.jpg


  • How the cloud failed me.

    We host our Linux boxes on Rackspace’s Cloud Server platform. We pay extra per month to use their Redhat Linux images. In return we receive all our patches and updates through Rackspace’s RHN Satellite server. Our thinking was that, we could purchase a Redhat support contract, and  since we were running Redhat we would have OS/Application support if needed.

    We were every happy with the service until the cloud failed me.

    It all started when the new WordPress 3.2 required PHP 5.2.4 or higher. Redhat 5.5 only shipped with 5.1.x. I needed to update my Redhat VMs to 5.6 as Redhat 5.6 had PHP 5.3.x. BUT. Rackspace decided not to deploy 5.6. They said it is coming, but weeks later I still can’t access it.

    They suggested I go to a non supported repo and install it from there. But that defeats the whole purpose of using Redhat on their VMs – I would not have a support path – Redhat would not support a package that was not in their repo (understandably).

    I was forced to buy Redhat support contracts for my servers. Now, we are paying twice for updates, with a support contract and with Rackspace’s extra cost per VM for running Redhat.

    We have all heard that “forced upgrades” is a downside of cloud services.

    This is the opposite – their cloud service is holding me back.


  • Adventures in Load Balancing: Kemp (@KempTech)

    My current project is a migration from Exchange 2003 to Exchange 2010. We wanted to load balance our CAS servers and do some SSL offloading. I have never worked with a load balancer before – pretty cool stuff. We have been using a couple of Kemp 2600’s in an active passive configuration. The Kemp devices have a nice price point and seem to have all the functionality that we need. Plus the support has been excellent. They have really helped us get up and running. Things I have learned while implementing these devices:

    • You actually set the CAS servers IP gateways to the load balancer. I guess the device acts like a router when it receives new traffic that did not originally pass through the device.
    • Clients and servers can not be in the same subnet if you want to use Layer 7 transparency. Traffic will hit the load balancer and it will pass it along to the server. The server will see that the traffic originated on the same subnet, and it will send the return straight back to the server, not through the load balancer. Timeouts result.
    • The documentation repeatedly refers to “clients”. A “client” can be a workstation, but it can also be a service.  Our BES server was connecting to the CAS to find the “/Autodiscover/Autodiscover.xml” info. Since it was on the same subnet as the CAS servers, they replied back directly and not through the load balancer. Timeouts again.
    • I really like the idea of a drain stop. I can move all traffic to one CAS and work on the other.
    • We ended up turning off Layer 7 transparency since we have all servers on the same subnet. The only other real choice would be to move the load balanced servers to their own subnet. The loss of transparency means that all connections seem to originate on the load balancer. So logs become pretty useless. Trouble shooting will occur on the Kemp. We can always ssh in and run a TCPDUMP.
    Now I need to find other cool things we can do with these cool Kemp boxes.

  • Windows Server 2008 persistent routes

    I can never remember this, so I thought I would blog it

    route -p add XXX.XXX.XXX.0 mask 255.255.255.0 YYY.YYY.YYY.1

    XXX = Network
    YYY = Gateway


  • Changing NIC order in 2008 R2 SP1

    I can never remember how to change the NIC order in 2008 R2. Navigate to “Networking Connections” and then hit “Alt” to bring up the menu. There you can find “Advanced” menu and the “Advanced Settings” option. There has to be an easier way, but that is the only way I know hot to get to it.

    Poor design.


  • OS X: Running a script when a USB drive is inserted

    I rsync all my data to a USB drive that I keep at work. I wanted a way to have my rsync script automatically run when I plugged in the drive – kinda like Time Machine.

    It ended up being pretty simple. All I needed to do is create and AppleScript and attach it to a “Folder Action” for the /Volumes folder. This script below is launched when a new item is added to the /Volumes folder, i.e. when you insert a new volume. This script will try to run a BASH script if it exists on that volume (.OnInsert)

    on adding folder items to this_folder after receiving these_items
    	repeat with current_item in these_items
    		try
    			do shell script POSIX path of current_item & ".OnInsert"
    		end try
    	end repeat
    end adding folder items to
    

    Save this as a .scpt file and put it in ~/Library/Workflows/Applications/Folder\ Actions folder.
    Next, right click the /Volumes folder and select Services -> Folder Action Setup and attach the script you just created
    AutoMagic!