Remotely restart Timbuktu when it stops responding

Mar 25, '09 07:30:00AM

Contributed by: Al_Tucker

I've been using Timbuktu for many years now, and like SSH Bouncing (a problem I solved in an earlier hint), after upgrading to Leopard, I also found that occasionally Timbuktu would go deaf, leaving me unable to connect to Timbuktu on my home machine while at work. SSH would still work, but that was useless to, say, open up Quicken and enter in what I spent for lunch.

I was able to remotely restart my machine via sudo shutdown -r now, and Timbuktu would work fine on restart, but that would forcibly crash anything on my home machine that had been open. I wished that Timbuktu had the plethora of command-line options that Apple Remote Access did.

Later it occurred to me that perhaps in the same way that it's possible to restart some UNIX processes with a HUP signal, maybe I could do that with Timbuktu. And it worked! So all you GUI folks will have to delve into Terminal, but here's how you can restart Timbuktu on a remote machine without a messy wholesale reboot. Really, don't be afraid.

Here's how I do this:

  1. Open Terminal and connect to the remote machine via SSH (a port that's open anyway since we all set Timbuktu to only use SSH encrypted connections these days, right?) by typing:
    ssh username@remotecomputer.net
    where username is your admin user ID on the remote machine (you must be an admin!), and remotecomputer.net is the IP number or DynDNS name or whatever internet name you use to normally reach the target machine.
  2. Once connected, type:
    ps aux | grep Timbuktu | grep root
    Remember that on the command line, case matters -- so don't forget that capital T! What we just did was use the ps command to show running processes, filtering for only those belonging to Timbuktu, and then from that list, filtering for only the ones running as the superuser (root) -- "The One over all."

    In my example below, this returned one line of textual information, but sometimes I see two (still not sure why sometimes I see one, sometimes two). Either way, you'll see something like this:
    root 15883 0.1 0.3 457348 6288 ?? S 12Mar09 153:23.42 /Applications/Timbuktu Pro/Timbuktu Pro.app/Contents/SharedSupport/Timbuktu Host.app/Contents/MacOS/Timbuktu Host
    If you're not command line proficent, don't worry! You only care about the number in the second column (15883 in this example). That's the PID (Process ID), and you're going to send it a HUP signal, equivalent to a restart. The number you see will (more than likely) not be 15883, but that's OK. Just note whatever number you see there.
  3. Type sudo kill -1 15883 (again, you substitute whatever number you saw in the above output for the 15883 in my example. You'll be asked for your admin user password, so type it in and press Return. If you saw two lines when you ran the ps command, then type the kill line one more time, this time substituting the PID from the second column of the second line you saw.
That's it, your stalled Timbuktu has been restarted! Optionally, you can rerun the ps command from step two to verify that it is indeed running (note the new PID number(s)). If you're really curious, run the ps command without the grep parts to see process lines for everything running on your Mac.

But you don't have to. Type exit to quit the remote shell, and you can connect with Timbuktu as normal now.

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090322205702991