Blog

Setting Up Servers by Hand, Like Grandma Used to Do

I’m working on an app for tracking meals at work, so I’m setting up a couple Mac minis as servers.

Settin up Mac mini server

The first time I worked on this app, I used MAMP to help with development. It was very handy and made a complex task much easier for me.

But, I always felt like I was taking the easy way out. That by skipping the server setup, I was missing some knowledge that would be useful, elsewhere.

So, now that we’re slowly returning to work, I have been charged with getting the Meal Tracker back up and running.

This time, I have a couple Mac minis (one at home and one at work). I’ll be setting them up with MySQL and PHP and Apache. And, I’ll be setting them up “properly.”

I found these pages useful:

Install Apache, PHP, MySQL and phpMyAdmin on Mac OS X

Updating Apache, PHP, and MySQL for macOS Catalina

I was thinking that something that has changed, since the last time I worked on this, is that I’m much more comfortable working in the Terminal and working on servers, in general. This time, I am using Homebrew to help manage installations.

But, now, I’m wondering about whether I should be using Docker…

Notifications via the terminal

Oh man! This will be a very handy tool to have.

At work I use Apple Remote Desktop to manage the school’s computers.

One of the features of Remote Desktop is the ability to run shell scripts on any or all of the machines.

Sometimes, my shell-script-fu is weak, but I know how to do it with Applescript.

But, Remote Desktop doesn’t allow me to run an Applescript in the same way. That is, I can’t send a string of Applescript commands to a machine over the network, and have it do the bidding of the Applescript.

I have created some Applescripts and I’ve saved them as applications, which I then trigger from Remote Desktop. But, sometimes, I need to just do a one-off task, and don’t want to write the script, save it as an application, copy the application to all the Macs, and then run the application.

In the past, I’ve seen ways to wrap an Applescript in a shell script, but I haven’t used that before.

I have a task now, where I want to have the computers tell me their names. I was thinking of modifying a script that creates a text document, identifying the computer by name, and then sends a print job from each computer.

But, I thought, what about this fancy Notification Center. Can I tap into that?

Turns out the answer is yes!

How can I trigger a Notification Center notification from an AppleScript or shell script?

(Via Ask Different as Stack Exchange.)

Finding the OS Version via the command line

I was working on a user’s MacBook Air, trying to resolve a kernel panic.

I had been working in their account (the only account on the machine). I shifted my attention to something else.

After being unattended, it locked the screen.  The user was not around, and I was trying to figure out the version of the OS. Looking at the logs, it looked like it a networking library was missing or damaged. I suspected that a system update would fix this. But, how to figure out the OS version, when I couldn’t log in?

I thought I could reboot into Single User Mode and find it that way. 

Sure ‘nuff!

Here’s the string: 

sw_vers | grep -0 '[0=9]*\.[0-9]*\.[0-9]*'

It was running 10.9.2. I restarted the system, which then told me it had updates to install. I clicked on “Install Updates and Reboot.” A few minutes later, the Air restarted. I held command-S, and booted back into Single User Mode.

Ran the sw_vers again, and it replied “10.9.4"

Sweet!

(I had discovered the utility of SUM a few years ago, when I trying to troubleshoot lost user accounts. It’s been a very handy tool on some of the more odd or difficult issues, since)

Managing multiple printers via the command line - Mac OS X Hints

We have about 30 printers at work. I have an OmniOutliner doc that I use to keep track of printer models and locations.

I can get into the printers, remotely, via a web browser. I can also admin some of them with a vendor’s utility. 

But, both of those can be clunky when I need to work on more than one at a time, or when I need to adjust a group of staff’s printer settings.

I found this article on Mac OS X Hints whilst looking for some SNMP tools.

Managing multiple printers via the command line - Mac OS X Hints:

About the same time, same call

For a couple of weeks, about the same time every day, I would get a call from the lab coordinator that the computers were having problems connecting to the Internet.

The network pref pane said that the Ethernet connection was Connected.

Symptoms: A user would try to get to a website, like ixl.com or pbskids.org and the progress bar would stall about mid-way, and the browser window was blank.

I could remote in via ARD and look at the Network settings. All were correct. They all had a unique IP address, within the range of 192.168.0.2-192.168.1.253.

Using Terminal, I could ping outside servers.

I could launch VMWare Fusion, and using a browser, running on Windows, I could reach those same sites.

I tried resetting Safari, clearing the caches in Firefox, reinstalling the browsers.

Then I found this thread: https://discussions.apple.com/thread/4093878?start=0&tstart=0

Solution: Turn off IP6 (!)

Open the Network Pref Pane, unlock using the pref pane

Click on "Advanced..."

Change the value for "Configure IPv6" from "Automatic" to "Off"

Click "OK"

Restart the iMac.

It works!

Apple Makes Me Laugh...Again

We recently added an AppleTV to our home entertainment setup. I love it. It solves multiple problems we have encountered with our “home media experience.”

Our CD collection used to be right next to our CD player. It was easy to browse and select something to play. Our collection now has almost 2000 CDs and they’re now in a room at the other end of the house.

It’s really cramped the music listening. As a result, we don’t listen to our music as much. We listen to the radio (which, in my opinion is not always desirable)

Another thing, we have thousands of photos. But we only have a few dozen printed out and on display.

The AppleTV has made it easy to browse our collection of music, photographs, and movies. And it’s done it without adding (a) stacks of discs to our living room, or (b) lots of big electronic boxes to our living room decor. (not that I’d mind, but I’m not the only one who lives here.)

As much as I dislike most traditional radio stations, I love the medium. So, I’m turning to internet-based stations. On my desktop computer, which is in the office, at the back of the house, I can use iTunes to browse and listen to tons of great stations.

I know that there are others in my house that are turned off by the list of hundreds of stations. So I created a playlist of about a dozen internet radio stations in iTunes. I was a bit irked when it didn’t appear in my list of playlists on the AppleTV.

But, just now, I went to the radio section of AppleTV and at the top of the list of genres, is my playlist! It made me laugh! I love it!

The Secret Diary of Steve Jobs : A not-so-brief chat with Randall Stephenson of AT&T

The Secret Diary of Steve Jobs : A not-so-brief chat with Randall Stephenson of AT&T.

Fake Steve Jobs rips Randall Stephenson a new one over the new plan that AT&T is going to start charging more money. FSJ uses a Beatles analogy to demonstrate why AT&T should be building out their network, instead of complaining. Love it!

I’m pretty sure that execs at this level never speak to each this way, but it’s very satisfying to imagine this is true.

Path Finder On Sale

One of my favorite programs is Cocoatech’s Path Finder.

Over the years, I’ve supported many users on Windows and Macintosh. Something I’ve noticed is that Mac users are more likely to fiddle with their file systems. That is, they spend more time organizing their files.

In general, I think that Mac people tend to be more spatial and/or visual, The Mac’s Finder (which is the program that you use to look through folders and launch programs) is more… uhmm…. trying not to start a flame war… better…. uhmmm… equipped with tools that aid in file management than Windows. With labels and breadcrumbs and various other little things that help a user know where they are. (I think this might become another post)

And Windows users throw everything into My Document, or more maddeningly, on the Desktop.

Anyways… what I’m trying to say, is that if you use the Finder a lot, you should definitely try Path Finder. It’s like a Finder on steroids.

Normally, it’s $40 – which, IMHO, is a great deal for something that you use every time you’re using your computer – and right now, it’s on sale. If you’re a student or teacher, you can get it for $24 (through Aug. 20). Or it’s $33 when you enter “TWEET33” when checking out through Path Finder’s integrated purchase system.

It has a 30 day trial, so give it a shot. You might thank me.

FYI, Old Tech Still Works

I’m currently lusting after a MacBook Air for my mobile life.

For the past 5-6 years, a laptop has been my main system. But I was recently blessed with an iMac, which has become my “main” machine.

Mostly, I use my iBook for browsing the ‘Net, and writing. My iBook is a 600MHz G3 with a 802.11b airport card.

But I must say, when listening to 128K radio streams or music from our music library (a TiBook that’s now our media server), it works great!

[UPDATE] As I re-read this few days later, I realize that I said that I’ve been using a laptop for the past 5-6 years, but I just remembered that before my TiBook, I was using a PowerBook 3400. As a freelancer, it was a great machine. And being mobile was efficient and freeing! I purchased my 3400 (200Mhz 603e) in ‘98 or ‘99. 10 years ago! Yikes!

I Love iTunes!

Sometimes, while browsing with my iBook, I’ll open up iTunes and listen to a radio station. I usually listen to my local classical station, KPBS.

When I tuned in, I wasn’t really interested in what was playing. I hopped over to the listings under Ambient, and I found “Birdsong Radio.”

I thought “clever name” and I clicked on the link. I was expecting some ambient chill, but it really is birdsongs!

I can totally see putting this on when I don’t know what I want to listen to. I love the ‘Net!

Per-Song iTunes Plus Upgrades Now Available

Great news! Apple will now allow you to choose the songs you want to update to iTunes Plus!

There’s more info at Ars Technica – Per-Song iTunes Plus Upgrades Now Available.

At 30¢ a song, I think it’s a good deal. In the past, I’ve upgraded my songs whenever possible, Once a month I’d check to see if I had any songs that were eligible, and if they were, I’d upgrade. A few cents here, a buck there. Nothing too much.

After the announcement at the latest Macworld, I went to upgrade my songs. It turned out that it was going to cost me $50! I can afford $10, but $50’s a bit much for me, right now. I did not realize that I had so many iTunes purchases. (that’s X songs, FYI)

There are some songs in there where I’d really like to have them at 256K, but there are some where it’d be nice, but not so important.

I think I see some iTunes browsing in my future…

(Thanx to Daring Fireball)

The Caveman Calculator

While searching for an RPN calculator widget, I found The Caveman’s Calculator. It’s a slide rule!

"Download it now and rediscover the lost art and fun while impressing (or perhaps losing) your friends."

Recently, my Dad gave me a couple of slide rules. I just can’t throw them away. They’re very cool.