Backup a Linux machine with LVM Snapshots and rdiff-backup

Here is the completed script I wrote on Episode 461. Make sure you check out the full episode for details on how to make this work for you.

And of course, here is the episode:

Plex Media Server on a Raspberry Pi 3

I wanted to document the instructions shared on Episode 459 to supplement the episode.

On the show, Jeff and I demonstrated how to turn a Raspberry Pi 3 with Raspbian Jessie into a Plex Media Server, giving you the chance to stream your entire video and music library to all your devices.

I won’t get into the full details here, since this is only a supplement to give you some copy-and-paste instructions, but I’d encourage you to watch the video.

What You Need

  1. A Raspberry Pi 3 Micro Computer. Please consider purchasing it through our store to support what we do: https://cat5.tv/pi
  2. Raspbian Jessie – A free download from raspberrypi.org
  3. Obvious stuff like a good MicroSD card, Ethernet cable (preferred as opposed to wifi), keyboard and mouse… etc.

How to Do The Do

  1. In terminal, upgrade your distro to the latest and greatest.
  2. Reboot the Pi.
  3. Add the ability for apt to use https repositories.
  4. Add the Plex Media Server repository provided by Universität Leipzig.

    Add this line:
  5. Add the GPG key for the repository.
    This is the “easy” method (which didn’t work for us because my keyboard was in some weird mode with no pipe character):

    Alternate method (which I had to use on the show since I didn’t have a pipe character… I’ve cleaned it up a bit since the live show so it is cleaner since it was an unexpected twist and I kinda made it seem more confusing than it should):
  6. Update apt.
  7. Install Plex Media Server.
  8. Create the default config file so Plex knows what user to operate under.

    (Thanks to Steve for submitting this additional step)
  9. Reboot one final time.

And there you have it! All the commands we used to get Plex Media Server installed on a Raspberry Pi 3 in a nice clean blog post  🙂

From there, we plugged in the USB flash drive (don’t do it! Use a proper external hard drive–this was only a demonstration) and after it mounted we used the following command to see its /dev assignment:

Since our drive was /dev/sda1, and of the filesystem type “fat32” this is what I did to make it work as the media library for Plex Media Server:

and add the following line:

I then created the mountpoint:

and made it so it can only be written to if mounted:

and finally, mounted the drive:

From there, I could easily add folders on my external drive to Plex using the web interface, which you’ll find on Port 32400 in the /web subfolder on your Pi.

To get my IP address, I brought up the terminal on the Pi and typed:

That showed the IP address of my Pi under “Ethernet”… 192.168.0.105

So to open Plex in my browser, from my computer I entered:

The IP address will most likely be different for yours, and you might even want to set it up as a static IP. Easiest way to do that would be to use your router’s DHCP reservations to hard-set the Pi to something outside your DHCP pool. For me, that’d be 192.168.0.5 or something like that, since the pool seemingly starts at 100.

Good luck, and if you have any questions or comments, please leave them below. Don’t forget, if this has helped you out, or if you just love supporting nice guys who wanna keep giving knowledge for free, please head over to our Patreon page, or throw a bit in the tip jar. Thanks!

NEMS – Nagios Enterprise Monitoring Server for Raspberry Pi 3

NEMS – Nagios Enterprise Monitoring Server for Raspberry Pi

NEMS is a modern pre-configured, customized and ready-to-deploy Nagios Core image designed to run on the Raspberry Pi 3 micro computer. At its core it is a lightweight Debian Stretch deployment optimized for performance, reliability and ease of use.

NEMS is free to download, deploy, and use. Its development however is supported by its community of users. Please consider contributing if you can.

Please Note: NEMS 1.2 is my most ambitious NEMS release yet. Please consider throwing a little gift in my Tip Jar if you find NEMS saves you time or money. Thanks!

[NEMS Documentation]

Index

NEMS 1.1 Featured on Category5 Technology TV

What Is Nagios Core?

Nagios® Core™ is an Open Source system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.

Some of the many features of Nagios Core include:

  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk usage, etc.)
  • Simple plugin design that allows users to easily develop their own service checks
  • Parallelized service checks
  • Ability to define network host hierarchy using “parent” hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
  • Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
  • Ability to define event handlers to be run during service or host events for proactive problem resolution
  • Automatic log file rotation
  • Support for implementing redundant monitoring hosts
  • Optional web interface for viewing current network status, notification and problem history, log file, etc.

Why NEMS?

Nagios doesn’t need a big fancy supercomputer to offer exceptional enterprise monitoring of network assets and resources, so our temptation is to re-purpose older servers to perform this reasonably lightweight task.

If you ask me, that’s not only overkill, but the attempt to save money by reusing older hardware will actually cost more due to higher electricity usage vs. a tiny Raspberry Pi 3 Microcomputer… which ironically may in fact have more modern system specifications than that old beast of a server you’ve been using.

It can be a wee bit daunting to setup a Raspberry Pi Nagios server from scratch, and there were no projects I found which were actively maintained at a level adequate for professional use. So I decided to start a new project–called NEMS: Nagios Enterprise Monitoring Server (for Raspberry Pi).

This project uses freely available applications such as Debian Linux, Nagios Core and a variety of other goodies, and I too release a fully ready-to-use image for you to use within yours or your customer’s network environments.

About NEMS

The goal with NEMS is to provide a free, full-featured, up to date drop in Nagios Enterprise Monitoring Server for Raspberry Pi 3. It has all the bells and whistles while being optimized for solid stability and fast performance.

The original NEMS release was based (with big thanks to Ryan Siegel) on NagiosPi, with many of the settings reflective of the NagiosPi Wheezy distro (which is now obsolete).

Here is what Ryan Siegel (the creator of NagiosPi) has to say about NEMS: “I’d love to upgrade NagiosPi, but i don’t have ability to make a GUI that can beat that of NEMS. I strongly feel that it has always been a necessary addition to NagiosPi and NEMS was able to deliver what is essentially an updated and improved version of NagiosPi. No reason not to start using NEMS for the time being. Nice work Robbie!” [source]

NEMS has since become a popular drop-in Nagios distro for Raspberry Pi, with a major release twice per year.

If you like NEMS, please donate: donate.category5.tv

The Out-Of-The-Box NEMS Experience:

System Requirements

  • Raspberry Pi 3 Micro Computer
  • 8GB+ Micro SD Card (Recommend 16GB+)
  • Network Connection (will obtain IP address via DHCP: create your reservation in the DHCP server for ease of access)
  • Internet Connection

Instructions

  • Purchase and assemble your Raspberry Pi 3.
  • Download the most current version of NEMS below.
  • Unzip and “Burn” the image to your Micro SD card.
  • Boot your NEMS server.
  • Login to NEMS console by either connecting a monitor and keyboard, or using ssh (Username: pi / Password: raspberry)
  • Type: sudo nems-init
  • After rebooting, reconnect and restore your backup.nems NEMS-Migrator file if you have one.
  • Edit /etc/nagios3/resource.cfg and add your SMTP information.
  • Login to NagVis and change the password (default is: admin/admin)
  • Reboot your Pi and enjoy NEMS when it comes online (see below for further details).

Buy The Needed Hardware

Raspberry Pi 3 Nagios ServerRaspberry Pi 3 are very affordable, and using our Micro SD image, you simply buy the device, “burn” the image to the Micro SD card, and boot it up.

Here’s our link to buy the device you’ll need, complete with the Micro SD card, a power adapter, a good solid case, and more: shop.category5.tv

Please buy it through that link, or let me know if you need a customized link to a different model. We get a small percentage of the sale, and it helps to make it possible to offer this as a free download.

Download NEMS 1.2

NEMS 1.2 Raspberry Pi Image

NEMS 1.2 Image File (zipped) – 1.93 GB (5.27 GB Uncompressed)

Please Note: I have included an MD5 Checksum within the Zip file. Please use this to confirm your download was successful. Some users have reported problems with the download. If this happens to you, please let me know. I’m trying to find the underlying issue.

Unzip and “burn” to 8 GB+ Raspberry Pi 3 Micro SD Card (I recommend you use at least a 16 GB card so there’s plenty of room for logs, configs, data and so-on).

Upgrade to NEMS 1.2

  • Upgrade from NEMS 1.1
    1. Connect to your existing NEMS dashboard from your computer and press Migrator->Backup. That will give you your backup.nems file.
    2. Deploy NEMS 1.2 on a new card (please use a new card so you can always revert back to your existing NEMS 1.1 if you have a problem).
    3. Boot your Pi into NEMS 1.2 and initialize it as normal (instructions are provided via your web browser when you connect)
    4. Once you get to the dashboard simply click Migrator->Restore to open the documentation which walks you through restoring your settings from your backup.nems file.
  • Upgrade from NEMS 1.0 or nagiospi
    See legacy upgrade documentation here: http://www.baldnerd.com/nems-migrator-legacy-upgrade/

NEMS 1.2 Changelog
NEMS 1.2 was released May 6, 2017. Here is a list of the changes I recorded during development.
– NEMS now requires you to run nems-init when you first deploy. This tool takes care of some of those “first boot” prerequisites like setting passwords and expanding your filesystem.
– Underlying OS upgraded to Raspbian Stretch.
– Kernel upgraded to 4.9.25.
– PHP upgraded to 7.0.16.
Reworking of nConf to make compatible with modern software (ie. PHP7.0, mySQLi).
– Maintenance and info scripts moved to /home/pi/nems-scripts.
– NEMS MOTD upon login now shows local IP address. Also improved how it determines some of the info (see info.sh in nems-scripts) and fixes a few bugs.
– Temporary files and Monitorix image cache moved to RAM.
– Added RPi-Monitor as per Hesh’s comment. Reworked the Memory and CPU Frequency modules to correct the accuracy.
– Added nagios-api (JSON on Port 8090) as per Timothy Seibert’s request. [License]
– Added Webmin as per Hesh’s comment. Login as pi user with the password you created when initializing NEMS with the nems-init program.
– Added support for agentless Windows checks using WMI (big thanks to Ryan Siegel).
– Changed Apache log rotation to weekly (was previously daily).
– Upgraded nagvis to 1.9b16.
– Fixed sendemail paths in nConf to ease out-of-the-box email notifications (as they should just work now). Thanks so much to Jim for pointing this typo out!
– Enabled CPU governing (package cpufrequtils). On NEMS 1.0-1.1, NEMS was locked to 600MHz, but now it will automatically go up to 1200 MHz as needed.
– force resolver to generate new DNS resolv.conf at first boot (to ensure the detected DNS servers will be used rather than our development DNS servers which may not work for you).
– NEMS Migrator upgraded to allow direct migration from nagiospi to NEMS.
– Added Monitorix 3.9.0.
– nConf and NEMS-Migrator backups now require your password (as set with nems-init).
– NEMS-Migrator no longer replaces the MySQL database. Instead, it now clears the database completely, reconciles your backup with the current set of available commands and services and then imports everything together into the fresh database. This way, if you restore your NEMS 1.1 settings to NEMS 1.2, you don’t miss out on all the WMIC features (which your 1.1 backup would overwrite), for example.
– Documentation updated to reflect changes in commands and versioning.
– I built a quick but lovely interface for Monitorix to make it mobile responsive and a little more dynamic in its functionality.

Bug fixes:
– number of online users count on MOTD fixed.
– undefined constant in apache error log every 5 minutes leading to a bloated error log.
– added missing icons in check_mk.
– NEMS Migrator mail settings fixed when importing backup.nems from NEMS 1.0/nagiospi.
– many miscellaneous bug fixes.

Configuring Your NEMS Server:
Browse to: http://NEMS.local/nconf (or http://IPADDRESS/nconf)
Make changes to the config as needed for your environment (eg., add a host, service, edit a setting)
I’ve added a few sample configurations in there (v1.1+) to help you get started.
Click: “Generate Nagios Config”
If there are no errors, you will have the option to Deploy the new Nagios Config.

Using Your NEMS Server:
Browse to: http://NEMS.local  (or http://IPADDRESS)
Choose Nagios for a customized Nagios system (easy), or use the Reports to create sophisticated reports and custom dashboards (advanced).
To add hosts or configure your environment, use the built in “Configure Nagios” feature.

Passwords:
NOTE: You should change these defaults when setting up your NEMS server.
Nagios – U: nagiosadmin / P: nagiosadmin
Reports – U: admin / P: admin

Known Issues:

  • PNP4Nagios is installed, but not configured. You may encounter errors, which will be addressed in a future release.
  • If you encounter an issue, please report it in the comments below so I can work on a fix (or please post your fix to help others and possibly to have it integrated into the next build).

TO DO:
This list details features which are planned for future releases of NEMS. NEMS is released on a 6 month schedule, with a major release every May and November. Thanks to the NEMS Migrator, upgrading is a cinch.
– Further improve the mobile responsive layout for tablets and smartphones (It’s really rudimentary at the moment due to the nature of Nagios’ interface… frames? C’mon now.)
– Upgrade to MariaDB.
– Add a notification to the defaults that shows NEMS hard drive space.
– Upgrade Nagios to Nagios Core 4. (?) – Unlikely since most of the cool things about NEMS rely on Nagios Core 3.5.1 … at least for now.
– Further streamline the implementation of Check_MK. Deploy check-mk-server.
– Expand the documentation to include setting up SMTP and mail alerts, including a new video demonstration on Category5 Technology TV.
– Distribution via BitTorrent (if download count can still be accurately tracked).
– Create an OVA of NEMS for deployment on existing virtual infrastructures (just for the challenge/fun of it).
– Build a graphical interface for nems-init.
– Build a graphical interface for NEMS-Migrator’s “Restore” feature.
– I’m open to suggestions! Please post your comments at http://baldnerd.com/nems

Things I Will Not Do:
This is a list of features I will not implement.
– Raspberry Pi Zero, 1 & 2 support. Buy a Raspberry Pi 3. The higher performance of a Pi 3 is a major asset for a project like NEMS, so I will not be focusing any of my efforts on supporting legacy hardware.
– GUI/Desktop. NEMS is a Linux server. If you require a GUI/Desktop Environment, you’re doing it wrong. I have built a very nice, easy to use web interface, and have worked hard to provide good documentation to ease the complication of configuration for novice users. NEMS itself should not even have a screen connected to it. Just power and Ethernet. Everything happens either through your browser, or for advanced users, an SSH connection.

Who Creates NEMS:
Robbie Ferguson is the host of Category5 Technology TV. He’s the kind of guy who when he figures stuff out, he likes to share it with others. That’s part of what makes his show so popular, but also what makes NEMS possible.

Support What We Do:
This project is a part of something much bigger than itself, and we’re all volunteers. Please see our Patreon page for information about our network.
– Please support us by simply purchasing your Raspberry Pi at https://cat5.tv/pi
– We have some support links on the NEMS menu, such as buying from Amazon using our partner link. Please use these every time you use those stores. A small percentage of your purchase will go toward our projects.
– Your donations are VERY MUCH appreciated – https://donate.category5.tv – Please consider how many hours (and hours) of work this project has saved you, and how much you’ll save on hardware and even electrical costs as you consider contributing
– Our network also has a Patreon page – Please consider becoming a patron – https://patreon.com/Category5

Make it so mountpoint can’t be written to if not mounted.

Have you ever accidentally saved files to a Linux mountpoint when the drive wasn’t mounted, and then couldn’t mount the drive thereafter? Or worse, had a backup run when the backup drive wasn’t mounted, only to fill your filesystem and crash the server?

These problems can be avoided by simply making your mountpoint immutable! What this means is, your mountpoint (the folder itself) cannot be written to. However, even as an immutable folder, it can be mounted to, and the filesystem of the mounted drive then controls the permissions of the folders therein.

It’s a simple Linux command. We’ll pretend our mountpoint is simply /mountpoint. Here’s all you have to do:

Brilliant! And oh, so simple.

Here’s a sample of what happens when I do this as root. Note that ‘mymountpoint’ is setup for me in my /etc/fstab file so it normally auto-mounts.

Enjoy that little tidbit!

As a side note, you might want to also get a notification if your drive isn’t mounted… so you could use the mountpoint command to send you an email if there’s a problem. Just add something like this to your backup script:

That simply checks if /mountpoint is a mounted mountpoint. If yes, it does nothing. If no, it will send you an email.

-Robbie

Convert video to several JPG images on Linux without ffmpeg.

I admit… I do love PHP in the command line. Does that make me a bad person? 😉

Here’s a tiny little script that I wrote to create many JPG screenshots of a video file. I use this each week to create a bunch of stills from our broadcast so I can use them as thumbnails and so-on. I didn’t want it to depend on ffmpeg since I don’t have that on any of my modern systems.

It requires just three packages: mplayer mediainfo php-5

Save it as whatever.php and run it like this: php whatever.php file.wmv

It will create a folder called file-Screenshots/ and will save one picture per 10 seconds for any video source. Just change “file.wmv” to the name of your video. Include the path if it’s not in the current folder.

Hope it helps you out.

-Robbie

Find the version number of all WordPress installations on your Linux server.

I have a lot of customers running WordPress on our shared hosting servers, and sometimes they neglect to update their WordPress installs. [Rolls Eyes]

I need to know which of these sites are using an obsolete version of WordPress so I may contact the customer and warn them that they need to update their software.

So here’s a helpful little Linux command I whipped up and ran as root to go through my /home folder searching for all WordPress versions. I only had to run it as root because I am checking through all users’ folders, not just my own. If you only want to check your own user, you don’t need root access.

I ran this command from my /home folder on the Linux server:

find . -name 'version.php' -exec grep '$wp_version =' {} /dev/null \; > /tmp/wordpress-versions.log

Breakdown:

  • find . -name ‘version.php’
    Search through the current folder, recursively, for any file named version.php. This is where WordPress stores the WordPress version number.
  • -exec
    Execute a command with each found item.
  • grep ‘$wp_version =’ {}
    Look within the found version.php file(s) in a loop for the term $wp_version = and output the result.
  • /dev/null
    Trick grep into thinking there is a second file, forcing it to precede the output with the filename provided by find
  • \;
    Close the find command.
  • > /tmp/wordpress-versions.log
    Save the results to a log file in /tmp. You can tail -f this file while scanning, or simply open or cat it when you’re done. Leave this portion out of the command if you’d rather have it output directly to your screen.

Memory leak in Zimbra 8.0.6 webmail

I’ve had a suspicion that since the Zimbra 8.0.6 update, something’s been wonky with Zimbra’s webmail client, so I decided to perform a very simple test: open Zimbra Webmail and leave it running.

Here is the outcome of that test.

Normal Operation for one business day.
This is how I operate day after day in my normal office environment.

Running:

  • Zimbra 8.0.6_GA_5922
  • Chromium Version 32.0.1700.123 Debian 7.4 (248368)

Memory Usage at Application Launch:

  • Browser window with Zimbra webmail client
    Thursday 8:47am – 139.5MB
  • Browser window with Google
    Thursday 8:55am – 45.92MB

Memory Usage ~ 24 Hours Later:
I left both browser windows running overnight. Here is where the memory usage stands…

  • Browser window with Zimbra webmail client
    Friday 8:28am – 564.3MB – 304% Increase in 24 Hours
  • Browser window with Google
    Friday 8:29am – 60.78MB – 32% Increase in 24 Hours

Memory Usage ~4 Days Later:
I left both browser windows running over the weekend.  Here is where the memory usage stands…

  • Browser window with Zimbra webmail client
    Monday 10:32am – 1.6 GB – 1,046% Increase in ~96 Hours
  • Browser window with Google
    Monday 10:33am – 60.53MB – 31% Increase in ~96 Hours

Since Zimbra cut the Evolution Connector from its product line, and the Zimbra Desktop software is still only available for a 32-bit platform, this leaves Zimbra operation on Linux sorely lacking. What has VMWare done?!  Hopefully Telligent can fix it.

-Robbie

*** UPDATE March 24, 2014 ***
We’ve ruled out Chrome by itself as the issue since it is only the window containing the Zimbra webmail client that shows any increase in memory usage.

To rule out browser extensions, I will run my next test with all Chrome extensions disabled.
Test 2 – Disable all Chrome Extensions and re-test.

Memory Usage After Weekend:

  • Browser window with Zimbra webmail client
    Friday 5:06pm – 106.3 MB

Memory Usage After Weekend:

  • Browser window with Zimbra webmail client
    Monday 8:37am – 1.7 GB

*** UPDATE April 15, 2014 ***
This has been added as a bug report for 88031 – https://bugzilla.zimbra.com/show_bug.cgi?id=88031

Preventing rsync from doubling–or even tripling–your S3 fees.

Using rsync to upload files to Amazon S3 over s3fs?  You might be paying double–or even triple–the S3 fees.

I was observing the file upload progress on the transcoder server this morning, curious how it was moving along, and I noticed something: the currently uploading file had an odd name.

My file, CAT5TV-265-Writing-Without-Distractions-With-Free-Software-HD.m4v was being uploaded as .CAT5TV-265-Writing-Without-Distractions-With-Free-Software-HD.m4v.f100q3.

I use rsync to upload the files to the S3 folder over S3FS on Debian, because it offers good bandwidth control.  I can restrict how much of our upstream bandwidth is dedicated to the upload and prevent it from slowing down our other services.

Noticing the filename this morning, and understanding the way rsync works, I know the random filename gets renamed the instant the upload is complete.

In a normal disk-to-disk operation, or when rsync’ing over something such as SSH, that’s fine, because a mv this that doesn’t use any resources, and certainly doesn’t cost anything: it’s a simple rename operation. So why did my antennae go up this morning? Because I also know how S3FS works.

A rename operation over S3FS means the file is first downloaded to a file in /tmp, renamed, and then re-uploaded.  So what rsync is effectively doing is:

  1. Uploading the file to S3 with a random filename, with bandwidth restrictions.
  2. Downloading the file to /tmp with no bandwidth restrictions.
  3. Renaming the /tmp file.
  4. Re-uploading the file to S3 with no bandwidth restrictions.
  5. Deleting the temp files.

Fortunately, this is 2013 and not 2002.  The developers of rsync realized at some point that direct uploading may be desired in some cases.  I don’t think they had S3FS in mind, but it certainly fits the bill.

The option is –inplace.

Here is what the manpage says about —inplace:

This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is complete, rsync instead writes the update data directly  to  the destination file.

It’s that simple!  Adding –inplace to your rsync command will cut your Amazon S3 transfer fees by as much as 2/3 for future rsync transactions!

I’m glad I caught this before the transcoders transferred all 314 episodes of Category5 Technology TV to S3.  I just saved us a boatload of cash.

Happy coding!

– Robbie

Running phpcs against many domains to test PHP5 Compatibility.

Running a shared hosting service (or otherwise having a ton of web sites hosted on the same server) can pose challenges when it comes to upgrading.  What’s going to happen if you upgrade something to do with the web server, and it breaks a bunch of sites?

That’s what I ran into this week.

For security reasons, we needed to knock PHP4 off our Apache server and force all users onto PHP5.

But a quick test showed us that this broke a number of older sites (especially sites running on old code for things like OS Commerce or Joomla).

I can’t possibly scan through billions of lines of client code to see if their site will work or break, nor can I click every link and test everything after upgrading them to PHP5.

So automation takes over, and we look at PHP_CodeSniffer with the PHPCompatibility standard installed.

Making it work was a bit of a pain in the first place, and you’ll need some know-how to get it to go.  There are inconsistencies in the documentation and even some incorrect instruction on getting it running.  However, a good place to start is http://techblog.wimgodden.be…..

Running the command on a specific folder (eg. phpcs –extensions=php –standard=PHP53Compat /home/myuser/domains/mydomain.com/public_html) works great.  But as soon as you decide to try to run it through many, many domains, it craps out.  Literally just hangs.  But usually not until it’s been running for a few hours, so what a waste of time.

So I wrote a quick script to help with this issue.  It (in its existing form – feel free to mash it up to suit your needs) first generates a list of all public_html and private_html folders recursive to your /home folder.  It then runs phpcs against everything it finds, but does it one site at a time (so no hanging).

I suggest you run phpcs against one domain first to ensure that you have phpcs and the PHPCompatibility standard installed and configured correctly.  Once you’ve successfully tested it, then use this script to automate the scanning process.

You can run the script from anywhere, but it must have a tmp and results folder within the current folder.

Eg.:
mkdir /scanphp
cd /scanphp
mkdir tmp
mkdir results

And then place the PHP file in /scanphp and run it like this:
php myfile.php (or whatever you ended up calling it)

Remember, this script is to be run through a terminal session, not in a browser.

See what we’re doing there?  Easy breezy, and solves the problem when having to run phpcs against a massive number of domains.

Let me know if it helped!

– Robbie

Walk-in Wifi Responder

Had a thought this morning that wifi could be used to do some pretty rad stuff… like detecting when I get home by noticing my iPod touch.

Since most of us carry wifi-enabled devices with us at all times, and most of us have them set to auto-connect once in range of our routers, I thought, why not use that data?  It could be as simple as logging coming and going, or as sophisticated as automatically turning on my favorite music when I walk in the door.  Or even adjusting the thermostat when I arrive home to save energy when nobody is around.

As a very brief proof of concept I whipped out a simple algorithm in PHP which can be run from any Linux computer on your network.

Usage:  php wifi-check.php –device=devicename

My thinking is to put something like this in a looping script and let it run every so many seconds or something, calling particular functions if the device is detected as active vs inactive.

I’d welcome your thoughts in the comment section below.  What practical things could this be used for?