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 …


My First Cron Job(s)

Learning from this great “Automated Tasks” page at

Normally, I prefer stuff like this in a well-written tutorial (see below awesomeness from DigitalOcean) but the above is … wow.

Tangent Sidebar: You know what’s kind of irritating? How I use DigitalOcean documentation all the time — not just because it’s higher in the Google results but it is so much better than the documentation of my actual host. Far more subjects, ridiculously specific, much better written, and far more accurate.

Two cases in point:

The latter is especially useful today because I keep getting emails from Let’s Encrypt reminding me to renew my shizzle.

But, as it turns out, none of those told me exactly what I needed but this did:

How to run PHP scripts from cron jobs

That’s my host. I’m very proud of them. And if their customer support is ever consistently good or consistently “not bad,” I’ll totally apologize. Interestingly, that tute gave me the final piece I needed but if I hadn’t read the other tutes first I’d still have no idea what to do because it only gave the final step, not the first several. That’s my host.

The first three (the good) tutorials taught me how to write a line in the crontab using the columns:

  • minute
  • hour
  • day
  • month
  • dayofweek
  • command

“How to Use Cron …” even gave me the “shortcut” of using @weekly instead of 00**0.

But Newbie: Intro to Cron which I think — sincerely and seriously — is a beautifully designed page, gave me the best tip in telling me to look for the following folders in my /etc directory:

  • cron.daily
  • cron.hourly
  • cron.monthly
  • cron.weekly

Dude. Just drop a script in one of those and viola!

And … and … earlier, one of those tutorials stated, “Cron is a daemon …” and I wondered, “What is a daemon?” That Newbie tute said,

Cron is a daemon, which means that it only needs to be started once, and will lay dormant until it is required. A Web server is a daemon, it stays dormant until it gets asked for a web page. The cron daemon, or crond, stays dormant until a time specified in one of the config files, or crontabs.

I wish cogNiTioN wrote every tutorial on all of the sites and I wish all of the sites were designed like that one.

Okay, so I write a line in my crontab telling it to change directories to where I keep a certain php file, then use php to run that file. Like so …

00 16 * * * user-name cd /my/directory/path; php -q myfile.php

It’s almost 3:30pm now so in a little over half an hour, I’ll check to see if it worked. I’d love that. I’m rather sick of trying to remember to do this particular task.

I had it change directories first because from what I understand, the relative paths in the file would get all confused and fail if the little crontab tried to run the commands from /etc.

If you’re still reading and you care, it’s a script that will go grab popularity scores from Spotify for a bunch of artists I’m tracking.

Another nifty thing I think is interesting is … I did a magical “save as” on the php file I’ve been using for this task and realized, wow, the crontab doesn’t need all of the html, css, jquery, etc. because that’s for me to see so I know the script worked. Not only do I know it worked but the crontab couldn’t care less so I stripped it all out of a new, dedicated file. I also rewrote (or, rather, wrote a new script based on) the script I’ve been using because part of the original added rows to a table that the crontab wouldn’t look at even if it existed. Because the crontab doesn’t have eyes. And doesn’t care.

Mastering(?) My Domain Pt 2

Still trying to figure out the difference between namerservers and “a records” if there is any.

Reading DNS Management: Registrars and Nameservers, I found:

A domain’s nameservers … identify what set of servers … to obtain a domain’s DNS records. Your domain should have it’s nameservers pointed to wherever you … manage your site’s DNS records. For most people, their domain’s nameservers will point at their web host [or] anywhere that you can manage DNS. This means that if your domain’s registrar allows you to manage DNS with them, then you can point nameservers at your registrar’s nameservers and use their DNS management panel to set records.

At first I was all good. Nameservers point to DNS records. Your domain management and DNS management can be at separate places but I can set up my DNS stuff at my registrar (Arvixe is my registrar and has DNS management tools) … that sounds easy … My nameservers are Arvixe and so is my DNS stuff … but, of course, the phrase

you can point nameservers at your registrar’s nameservers

messes with me. I point my nameservers at my registrar’s nameservers? WTF does that mean?

It seems like you can also register your own nameservers using your IP address so you’re creating a nameserver so your server/host can point to itself? Is it really just me or is this really, really stupid?

You can, apparently, install DNS software on your server so your server points to a nameserver (that’s in itself) which points to DNS records (that are also in itself). Yes, I think I just answered my own question — this is definitely stupid.

Many articles say to ask your registrar and such for assistance but the support people at Arvixe (registrar) are all completely incompetent and the support people at A2hosting (new host) are all dicks.

August 1, 2017 UPDATE: “Matt S.” is so not a dick. He is the King of All Support Peeps and has, as I just told him, completely and totally restored my faith in A2hosting.

The Big Empty

Further VPS Adventures

Okay, I can finally (there were some issues) log in via ssh and access my shizzle via ftp.

First things would normally be install my webserver, MySQL, and php as well as configure all of those with no cPanel help. I’m excited.

It’s just a big empty computer with an empty root …

Speaking of … I thought “root” directory meant the biggest, outermost directory with everything else in it … so I’m already confused when I thought I knew where I was and what I was doing.

Anyhow …

But first thing for me now is editing a file to fix my domain issue (long story you don’t need to know because nobody but me will ever be in this situation). Instructions in the support ticket said to do this via nano but nano scares me so I’m downloading it via ftp, editing it locally, then uploading it, and … hoping it works. I think something I read or did in the past says you sometimes maybe can’t do that.

Diving Into VPS

I thought a Virtual Private Server (VPS) was just like a shared plan except it comes with nothing but I can put in anything I want. As it turns out, it’s not so simple.

My first foray last Friday night was so overwhelming and frustrating, I canceled my plan just a couple hours after getting it. Totally discouraged. Bummed.

Part of it was my own ignorance. I didn’t know what I didn’t know, as they say. But it was also a significant chunk of their fault. This host — we’ll discuss that later — has an unbeatable reputation and my previous experience with them was impressive to the max. Friday night — my first time getting support as a paid customer — sucked hardcore.

Refusing to be deterred, I kept researching over the weekend and found tons of resources for the newbie True Administrator. True Back End. No cPanel, not software, just … building a software fire with only a rock and some twigs. Here are the resources I’ve found that I’m about to start absorbing like a sponge. I’ll document everything I do so that anyone finding this isn’t as deer-in-the-headlights as I was.

In subsequent posts, I’ll explain what all these are and such. At present, this is just my list o’ links all in one place.

Free DNS Service

DNS Management: Record Types and When To Use Them

DNS Management: Zones, Record Types, and Record Composition

A2hosting How to configure a domain for a semi-managed product

A2hosting How to configure custom name servers

A2hosting Configuring domain settings

A2hosting VPS Quick Start Guide

3 Free Control Panels for VPS Administration

A2hosting How to access and use Webuzo on a semi-managed server

A2hosting Getting Started Guide: Accessing Your Account

How To Log In To Your VPS

A2 Hosting Ubuntu Virtual Private Server Guide

A2hosting: Ubuntu Virtual Private Server (VPS) Setup

Basic Virtual Private Server Administration

VPS Administration for the Absolute Beginner

Ubuntu VPS Step-By-Step Configuration Notes

VPS – Technical FAQ, Additional Services and Definitions

VPS Tutorial

How to Make a Web Site & App Part 1

Getting a Host

Two pieces of strong advice

  • Don’t use free hosting
  • Don’t overpay

With free hosting, you’ll have ads on your page and you won’t have essential things you need. I’m showing two outstanding hosts — neither of which pays me — that are super cheap and give you tons. Do not use GoDaddy (too much money for too little product), FourSquare, Wippet, Blobbix, or whatever those things are called.

Arvixe is the place I use. I came within a single breath of switching to A2 recently but didn’t.

Things they have in common that you must demand from any host:

  • Unlimited storage
  • Multiple/unlimited websites
  • cPanel (there are other control panels but I think cPanel is, hands-down, the best)
  • Unlimited subdomains, FTP accounts, email addresses (there are actually places that charge you to have any and some who charge for more than a few). Never, ever pay for these things. Ever.
  • PHPMyAdmin

Other things these guys have or support that others don’t:

  • Python
  • Node (definitely A2 and, I think, Arvixe)
  • Ruby on Rails
  • Reasonably up-to-date PHP, etc.

You are, after all, trying to become a developer.

About Arvixe


Cheap at $3.20/month (if you pay annually — a couple bucks more if you pay month-to-month) for multiple websites and … AND … a free domain for life with purchase of any hosting plan. I think that’s pretty darn cool. So you can get started with your little web business for under $6 right now.

They had PDFtk — the cornerstone of my new product — installed already. I almost switched to A2 because Arvixe’s support people said they didn’t have node and I thought that if they didn’t have a huge thing like node, there’s no way they’re going to have PDFtk.

As it turns out, they have both available for shared hosting.

Unlimited databases even with their cheapest plan.



  • They don’t have phone support like my old host did.
  • Their documentation is far from the best and their replies to comments aren’t helpful.
  • Their chat-based support staff take forever between Q&A … like they take walks afk while chatting with you
  • They’re support appears to be based overseas. Okay, fine, they’re hard to communicate with, okay? English is obviously not their first language … geez, you gotta make me say that shizzle?

About A2

A2 is what we from Ann Arbor, Michigan call Ann Arbor, Michigan. I remember thinking, “How cool would it be if A2 stood for Ann Arbor?” and, as it turns out …


Their cheapest plan is a few cents more than Arvixe’s cheapest plan but their next level up is a few cents cheaper than Arvixe’s next level up.


  • Node — rare and cheap considering it’s rarity
  • Pick your version of Python and/or PHP — trust me, that’s cool
  • Support # right there at the top of the home page
  • Chat support – quick to answer and they’re in Michigan, USA
  • 24/7 support


  • Limiting subdomains based on price is skeezy
  • So is limiting databases but not as skeezy as limiting subdomains
  • Maybe I’m spoiled and entitled but limiting email addresses is kinda skeezy
  • They wouldn’t install PDFtk if I switched to them. Maybe I’m being petty but typing “sudo apt-get install pdftk” (less than the most concise tweet) to get someone’s business for life seems like a small thing to ask. Sales told me that if I could find three other hosts that included it, they’d consider including it. I responded that I could only find three (this was before I found out Arvixe did) but, more importantly, I found oodles of people looking for hosts that included it. Regardless, like the Wizard who gave Dorothy & Company a bait-and-switch, they responded to my three hosts with the answer, “No.”


  • Their support staff — I had many long conversations with them while only thinking about becoming a customer and they were always patient and helpful.
  • If you’re getting their Swift plan (cheap!) the stuff you wouldn’t get with Lite is irrelevant.

Conclusion and Summary

Whoever you choose, make sure it’s someplace with a control panel, file manager, etc. — you don’t want to use templates or some “website builder.” You can get everything you want and need for fun, learning, and profit for the price of a latte a month.

FTP F’s With Me

Most of the Time: Configuring FTP settings is such a simple thing and, yet, it, more often than not, takes much longer than expected (which is to say, it doesn’t work easily and immediately) and troubleshooting ruins my day.

Just Now: Wowzers. Just set up Filezilla on this here new laptop and it worked right the first time.

My host (shout out to Arvixe–I’m quite pleased with their price, customer service, and products/features) provides downloadable configuration files for Filezilla, Cyberduck, and some random Windows thing. The config file for Filezilla worked instantly and perfectly.

I’ve often been frustrated that I’ve never seen a config file for Dreamweaver. Dreamweaver has always been my favorite dev app and FTP utility for ease of use and sheer volume of features but, sometimes, even it seems to confuse me. It’s probably not necessarily Dreamweaver but the names of fields in Dreamweaver don’t seem to match the names of info provided by any given host so I end up trying different combinations until it works and, as with other issues & situations, by the time something works, I’m so frantic and exhausted, I can’t even really remember what I tried that worked. So, Dreamweaver is innocent until proven guilty.

If I’m at home with my Mac or at a job that provides me the proper tools for my job (the Adobe suite–whatever it’s being called that week) I use nothing but Dreamweaver. It’s Site Manager and Files panel are unbeatable–especially because the Files panel has FTP built in (not to mention its integration with the Properties panel, etc.).

Seriously, Cyberduck gets one but Dreamweaver doesn’t? Hmm … perhaps making one is something I could work toward.

FileZilla, as separate apps go, keeps me happy. It is, of course, way better than using any given host’s File Manager to navigate between folders and upload files one at a time even if they’re in the same folder (not all hosts have that last little quirk but it’s the one flaw I can find with Arvixe … I should mention that it could be a browser or other issue but since I only use my host’s File Manager when I’m not on personal equipment I’ve never had a reason to find otherwise).

I can’t remember exactly why I don’t like Cyberduck–some frustration or other when my students and I were using it for class last time I taught. It’s what our abysmal curriculum had us use, that’s why.

I might be totally incorrect but it seems SeaMonkey‘s Publish feature forces you to enter FTP info for each file individually.Hmm … an open source project I can build some chops & reputation developing?

I miss Fetch. It my first. I miss the OS9 version, in particular, because I loved watching the cute little dog run during file transfer.