Why does it work? What happened?

All of a sudden! (That’s a Tourniquet reference) One week ago, my cron jobs started working. I’m very happy and very confused. I pulled what I’ll loosely call “reports” on various random artists to compare what time batches of data were pulled from Spotify to the times I set in the crontab — wondering if it was some weird fluke or maybe I’d done it manually (in the middle of the night) and just forgotten.

Good News: No ghosts or gremlins — they’re actually working.

When I got to Bloodgood, I received quite a shock.  Their #1 song was from their latest album. But wait, there’s more — these are their Top 25 tracks on Spotify:


Not only are most of them from Dangerously Close (2013) but most of the rest are from Out of the Darkness.

I would have thought the list would be dominated by tracks from Metal Missionaries and Detonation. I gave Dangerously Close a try when it was first released but didn’t like it and I only ever liked one song enough to remember it from Out of the Darkness (“Top of the Mountain” which appears twice in the top 25).

As it turns out, one need look no further to find evidence of how out of touch I am with other Bloodgood fans than the ranking of Rock in a Hard Place — my personal favorite Bloodgood album. It ranks last among their studio albums with the exception of … whoa … I thought Metal Missionaries was at the bottom because it’s a “25th Anniversary Edition” but there’s no “regular” edition elsewhere on the list.


I think I need to go back and listen to those last two albums … maybe I missed something.

However …

while requests for 12th Tribe data finally seem to be working (for some reason, they weren’t for a while), artist popularity for One Bad Pig has only been fetched (using the term loosely) twice and not since the middle of last December. Album and Track data is up-to-date but nothing for artist popularity. The same arrays are used for all of them … well, maybe it’s what my browser pulled just now and not really what’s in my database … hold on … nope, MySQL Workbench gives me just the same two rows.

Well, I’ll be …

One Bad Pig‘s latest album, Love You to Death (2016) is tied for first place as well. Wow, I thought that album kinda sucked, too. It’s tied with I Scream Sunday (1991) which … is their second most-recent album.

I keep waiting to exhale so I can maybe start working on the data viz for all of this …


Procrastinating Is Now A Tradition

I say “tradition” because, if it’s really a “habit,” that makes me very sad.

It turns out, My Second Cron Job didn’t do it’s job. I looked at it (after the first few of the new batch of reminder emails) but couldn’t figure out why it didn’t work. The tutorial mentioned in that post might just be wrong, I still need to check on that …

… someday.

On the bright side, My First Cron Job has been faithfully gathering data from Spotify. Once I have a little time — this isn’t procrastination, honestly, it’s time management with school, job, wife, kids — I need to write the other scripts to gather not just Artist data but also albums and tracks.

I really, really need to not put off security tasks because at best, somebody’s shizzle is compromised and, at worst, I can’t be a smug, self-righteous prick when others have security issues without being a hypocrite.

[Solved] Ubuntu Update Broke My WiFi


I have Ubuntu 14.04 with linux kernel 4.4.0-113-generic on a Dell Vostro 1000. This laptop’s maxed out processor and RAM are just enough for Trusty Tahr, so upgrading to 16.04 isn’t an option.

The Problem

I update whenever it asks. After the latest update, WiFi wouldn’t work. This happens fairly often. She’s a good dog, but she’s old. Restarting usually gives me bars. This time, however, I noticed there was no option for Wireless in the bottom panel’s network menu. Nor was it in Network Settings. Googling brought some old results but the situations and apparent cause were similar — an update broke the card/driver.

This post assumes your router works, your machine has any network connectivity at all, and there is, in fact, a signal to receive. If apes and/or zombies recently conquered your region, your laptop might be functioning as expected.

Quick Solution To Try But Didn’t Work for Me

Press Fn + F2.
I’d never noticed the little wireless symbol on that key before. Apparently, it toggles your WiFi. This didn’t work because, as we’ll see below, the laptop didn’t know it has a wireless card to turn on and off.

Hard Key on Outside of Laptop
Ye Olde Delle Vostro doesn’t have any such switch or slider and neither did some posting this problem (many people suggested trying it).

Kill Process That Is Blocking WiFi
This target process may or may not exist.

sudo /usr/sbin/rfkill unblock wifi

Solutions That Worked for Others I Didn’t Need to Try

This solution is especially handy if you have no network connection on that machine at all.

Solution That Worked for Me

Courtesy of overclock.net forums c. 2014

Run ifconfig to see your networking shizzle.

While broken, mine showed only eth0 and lo.

  • Eth0 = ethernet card
  • wlan0 = wireless card
  • lo = “loopback device … used for stuff to communicate on your system”
  • docker0 = I don’t know what that is

The overclock forum post included instructions for those with no network connectivity as well but I didn’t need them and am not including them here.

Type the following to see what driver is loaded and see what card you have.

lspci -v | grep -i network -A 6

My results showed my broadcom driver and, if memory serves, that something was denied (like the post at overclock). I have a card but it wasn’t recognized so the solution was to remove whatever the update added and/or reinstall whatever the update removed.

sudo apt-get purge bcmwl-kernel-source broadcom-sta-common broadcom-sta-source && sudo apt-get install b43-fwcutter firmware-b43-installer

That first part took a long time. Along the way, it asked me to confirm and when it was finished, I had to confirm it could do the second task.


Everything is, obviously, working fine now.

My Second Cron Job

Nothing like waiting until the last minute.

I’ve been getting increasingly frequent “renew your Let’s Encrypt cert” emails but the task kept getting postponed because I didn’t have the command(s) memorized and wanted to create a cron job for it but whenever I thought of it, I didn’t have the time or whatever to look it up or do it.

That’s my excuse.

Yesterday, I received the “your cert expires in 0 days” email and promised myself I’d renew it yesterday.

I didn’t.

This morning, I got up and had a faint hope that it expired at an exact time and not just the date. I checked that last email and the gods were merciful. I had a few hours left. Just renewed it and saw this in bright red amidst the bright green:

Encountered vhost ambiguity when trying to find a vhost for but was unable to ask for user guidance in non-interactive mode. Certbot may need vhosts to be explicitly labelled [sic] with ServerName or ServerAlias directives. Falling back to default vhost *:443 ...

I was concerned, especially because it was a particularly important subdomain, but below that I also saw (in the normal bright green):

Congratulations, all renewals succeeded.

I do want to check into that though. I’ll probably be as quick about that as I was about renewing …

I did, however, create the cron job so I wouldn’t have to stress or worry about it in the future. Things to note:

That tute states, “The certbot Let’s Encrypt client has a renew command that automatically checks the currently installed certificates and tries to renew them if they are less than 30 days away from the expiration date.” DO shows a cron task that tries the renew command every single day so if the cert is within 30 days of expiration, it gets renewed.

I know it’s a tiny little command, but I hate the idea of something happening every single day that doesn’t have to. I think running the command bi-monthly is best (“best” meaning it makes me feel like I’m beating the system) so I thought using * * 31 * * would be super-nifty. I thought months with 31 days are pretty much every other month so it would be perfect and I’m so brilliant.

When I drew it on the whiteboard I saw

  • It would have worked for today (Nov 24) because Oct 31
  • It would work for the next renewal in 90 days on Feb 24 because Jan 31
  • Before it hits another two consecutive renewals successfully (Aug and Nov 2018) it would totally miss May 2018 because April has only 30 days.

This concept could still work if I could get it to attempt renewal on the first day of a month following any month with 31 days.

TIL: You can use If statements in UNIX shell scripts.

For now, so that I can complete this task, we’ll just go with the first day of every month.

I’ll update this post once I write the shell script.

Hmm …

Just typed sudo ctrontab -e and saw what looked like an empty file. That command is what I usually see in cron tutorials. I wonder what it does …?

So, while I file that question away in a drawer I may never check, I’ll just edit the crontab file like I did in My First Cron Job post … as I suspected and hoped, my other command is, indeed, there with my new job now beneath it.


But there are still at least a couple things I want to know.

  • In my first cron job, I indicated a user because one (just one) tute said to and the directions in the file have a column for that. Do I need that? I didn’t put one for my new cron job so we’ll see.
  • In the first job, there’s a command to change directories which makes sense for the file and the scripts in that file. DigitalOcean’s tutorial that inspired my second job/line of code includes /usr/bin/certbot renew but, knowing that I can run certbot from any location, I’m going to see if I can omit that path. The script should run in a few days and I’ll also have a couple more months during which I can experiment.
  • That second command in the job writes the output of renew in a file located at /var/log/le-renew.log but that log file didn’t exist and I haven’t created it. I’m thinking that the command creates the file if it doesn’t already exist. We’ll see in a few days.

I wish I’d noticed where the renew command I did earlier stored any output. The tute states output should have included a line saving debug info to /var/log/letsencrypt/letsencrypt.log and I had already check in that letsencrypt folder to see if le-renew.log was in there. Trying to cd into it as me got me Permission denied and trying as root got me No such file or directory!

So, as I said, we’ll see …