backup2l troubleshooting – skipcond not ignoring paths

Something to watch out for…

backup2l, the popular Unix backup software, has a setting in /etc/backup2l.conf called skipcond that lets you ignore files/paths.  It uses find syntax.

You might have written something like this if you don’t want to both backing up old logs, say:

SKIPCOND=(-path /var/www/mysite/system/cms/logs/log*" -o -name "*.o")

But when you run backup2l -e to simulate the backup, it says:

856 / 43210 file(s), 13 / 5003 dir(s), 2.2GB / 4.3GB (uncompressed)
skipping: 0 file(s), 0 dir(s), 0 B (uncompressed)

You know this is wrong for two reasons, the overall size is too big and it’s not skipping anything.

This could be because of symlinks.  To debug, run a real backup (with the -b switch), and use backup2l -l [pattern] (where pattern is some file(s) you know are in the directory you want to exclude) to see what’s there.

You may find it’s actually backing up /usr/share/nginx/mysite, because /var/www is symlinked to it:

lrwxrwxrwx  1 root root    17 Aug  2  2015 www -> /usr/share/nginx/

Remember backup2l has a purge (-p) option that lets you remove individual differential or incremental backups by specifying the number. So if you’ve just run all.1375, say, you can delete that with -p 1375 and when you run it again it’ll reuse the number.

 

Keys

First they came for the § key, and I did not speak out –
Because I could never remember what it was for.

Then they came for #, and I did not speak out –
Because you just press opt+3* (and who uses it other than developers?)

Then they came for Delete, and I did not speak out –
Because you could still use Fn + backspace and in any case I had a full size, wired numeric keyboard.

Then they came for F13-F19, and I did not speak out –
Because they were so far away.

Then they came for the full height arrow keys, and I did not speak out –
Because I had mapped up and down to J/K with the Vimium extension.

Then they came for Pg Up/Down, Home & End, and I did not speak out –
Because my full size keyboard still had them and the icons confused me.

Then they came for Escape, and I did not speak out –
Because I could map it to Caps Lock (where it should have been all along) and I wasn’t planning to buy a Macbook anytime soon anyway.

* British layout

Why developers should turn off smart quotes

Ocassionally I write commands in my notes app before copying and pasting them into iTerm.  It’s very easy to type “regular quotes” and not notice macOS has converted them into “smart quotes”.

Then your command doesn’t run, and you get an error message that doesn’t make any sense because the arguments aren’t being parsed correctly, but you don’t notice at first it’s the quotes that are wrong because the font is too small and your mind is fixated on looking for spelling mistakes and syntax problems…

To turn them off, on a Mac go to:

System Preferences > Keyboard > Text > uncheck “Use smart quotes and dashes”

iOS 10 tips

Updated Fri 7 Oct 2016 with note about Emergency Bypass

  • Avoiding having to manually click/press the home button to unlock the phone when you are viewing the notifications screen (there isn’t any benefit to this on iPhone 6 or 6s).  Go to: Settings > Accessibility > Home Button > turn on “Rest finger to open”.The caption on the lock screen will still read says “Press home to open”, but you only need rest your finger on the TouchID sensor. Note this option is only available if the device has TouchID – if you don’t have a fingerprint sensor, you must click the (mechanical) button manually.
  • (not new to iOS 10) – if you are fed up of accidentally bringing up the Apply Pay / wallet screen because you clicked the home button twice by mistake when the display was off, go to Settings > Apple Pay and Wallet and turn “Double-Click Home Button” off – with this, double clicks will just wake/unlock the phone instead.
  • There’s a new Emergency Bypass setting in contacts.  You can set it separately for ringtones and texts and it’s described as allowing “sounds and vibrations from this person even when Do Not Disturb is on.”Be aware, however, it means your iPhone will sound for that person regardless of the position of the Ring/Silent switch – this may mean you don’t want to use it after all, if you want to guarantee your device will be silent when the switch is set to silent.

    I opened a bug report about it with Apple who closed the radar and marked it as “behaves as intended.”

Tips: Updating the Adobe Flash plugin for Firefox, Safari, Opera on Mac

I’ve routinely found the standard Adobe Flash player updater for Mac (OS X/macOS) fails right at the end, without explanation.

However there is a version that always works. Go to:

https://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-mac.html

… and choose Flash player for Safari and Firefox – NPAPI – the download URL is normally:

https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_osx.dmg

The opening dialog box should look a bit different – like this:

Adobe Flash Installer

Opera users

Use this version (last tested 10 Feb 2017):

https://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_osx_ppapi.dmg

Firefox plugin checker

This is a very fast and handy way of seeing if your copy of Flash or Silverlight is up to date.

https://www.mozilla.org/en-US/plugincheck/

Update: Yahoo! Weather

Since the old Yahoo feeds stopped working, I’ve switched my code to use https://developer.yahoo.com/weather/

Note, contrary to what the documentation says, you don’t  need any API keys or authentication.  You can just make a standard GET request and get JSON data back.

The developer page mentions a rate limit of 2,000 signed calls a day but again there’s no indication if/how this is being enforced.

The format is slightly different.  First you need to construct a YQL query, however this is well documented.

Some example PHP code of my own (using the FuelPHP framework):

// Build query for correct city
$BASE_URL      = "http://query.yahooapis.com/v1/public/yql";
$yql_query     = sprintf('select * from weather.forecast where woeid in (select woeid from geo.places(1) where woeid=%d)',
    \Fuel\Core\Config::get('default_weather_loc_id.yahoo'));

$yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json";

// Make call with cURL
$session = curl_init($yql_query_url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($session);

if (curl_errno($session)) {
    \Log::error('Yahoo check: '.curl_error($session));
}

$weather_data = json_decode($json);

if (! property_exists($weather_data, 'query')) {
    return false;
}

return $weather_data->query->results->channel;

Note, regardless how much data you request, the results are contained inside a JSON channel object, which is inside results, which in turn is within the main query object.

Troubleshooting Composer timeouts (IPv6 issue)

If composer hangs and you eventually see this error:

The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Operation timed out

it could be a problem with IPv6 (for example if you’ve lost your IPv6 address for some reason.)

On MacOS you can turn IPv6 on and off via the command line.  This:

networksetup -listallnetworkservices

…will give you a list of network interfaces (e.g. Ethernet, Wi-Fi, any VPNs)

networksetup -getinfo Wi-Fi

…will list all it’s settings; IP address, MAC and IPv6 status.

networksetup -setv6off Wi-Fi

…will turn IPv6 off. (To turn it back on, you’ll typically want -setv6automatic, though there’s also an option to set it manually.)

In my experience turning it off fixed the problem immediately, and composer worked straight away.

Obviously it’s preferable to fix your IPv6 and turn it back on, but this may be inconvenient if you have to reboot router etc. or beyond your control if there’s a problem with your ISP.

Useful page to test your IPv6 connection: http://ipv6test.google.com/

See also this GitHub issue

Tested with MacOS El Capitan 10.11.5