The URL to shutdown the mini NAS, surprisingly, accepts both POST and GET. This is great for me, since I like to shut down my whole home theater at night. The URL looks like:
And you can use WGET or CURL on pretty much any platform to call it from a command line.
As a follow up to my previous post, here’s how to do the same thing, but from a web browser (say, on your iPhone) — it assumes you’ve already written a shell script, as discussed earlier.
- Configure Apache to run PHP on your Mac (these instructions are for Leopard, but similar ones are out there for Tiger)
- Configure Apache to run as your own user, instead of the WWW user — a serious security risk. Only do this on an internal network! The WWW user won’t have adequate permissions to do what we need to.
- Put this .php page in your /Library/WebServer/Documents/ folder as RestartMedia.php — you’ll need to supply your own image file in the same path as well.
- Visit http://yourcomputer.local/RestartMedia.php from a browser. Clicking on the text or image will execute a shell script located at: /Applications/Automation/RebootMediaServers.sh
Obviously you can customize this at will, including file locations. This was just a quick hack that does the job for me — and the webpage is optimized for Mobile Safari.
Both my media serving devices (a NAS, and a Mac Mini) are using TwonkyVision Media Server to share media using uPnP. It works great, but as I mentioned earlier, I needed a script to make it start back up in the morning.
Unfortunately, I’ve found that my AppleTV freaks out a bit when this happens, and as a result, needs its own reboot. Restarting the Finder helps, but streaming still gets weird, so a full, daily reboot is in order. Using the same iCal-alarm-firing-an-AppleScript trick, I updated my Twonky restart script to also tell the AppleTV to restart. But it wasn’t that easy.
- First of all, you need to exchange keypairs with the AppleTV so that you can login over ssh without a password. If you’re using an older patchstick, the process is a little different, since it may only support ssh1. This wiki page explains the process, and the slight tweak to it for ssh1.
- Second, you need to set the AppleTV up to allow you to sudo without a password. This is harder than it sounds, and requires modifying the /etc/sudoers file on the AppleTV. The only way I found to do that was to
sudo cat /etc/sudoers > ~/sudoers the file (which dumps the contents of one file to another, which you can access more easily), copy it over to my Mac, edit it, copy it back, set the permissions, and sudo mv it back over-top the original. You’ll need to add this line to the bottom of the sudoers file:
frontrow ALL=(ALL) NOPASSWD: ALL
- Make sure you change the permissions (chmod 0440) and ownership (chown root:wheel) on your new sudoers before you replace the original, or you’ll screw yourself out of sudo!
To test those things, you could go to Terminal on your Mac and try something like:
ssh -1 firstname.lastname@example.org 'sudo ls-l'
(drop the -1 for newer Patchsticks)
If you’ve setup everything right, you shouldn’t get prompted for a password to login OR to get a directory listing. Once that works, the AppleScript is easy and looks like this:
do shell script "ssh -1 email@example.com 'sudo reboot' &> /dev/null &"
(drop the -1 for newer Patchsticks)
At some point, I’m also going to attach this to a PHP script (somehow) so I can use Safari on my iPhone to do a reboot from the couch if needed. I’ve only found two other ways to reboot the AppleTV — yanking the power cord, or using the remote to put it in recovery mode. Neither seems as elegant as my solution.
Derived from this forum post that solved the problem for me.
Sometimes (most of the time) the limited configuration for TwonkyVision that the MiniNAS config pages gives you isn’t enough. Trying to go to http://yournas:9000 results in the red error page. Apparently LaCie thinks they know better than their users.
To enable TwonkyVision config, upload this signed patch file (mirrored here, in case the original source goes away) in the Configuration page of the MiniNAS config, as an update.
Tested with 184.108.40.206 of the MiniNAS firmware.
So last night, after 4 passes, I finally got the AppleTV hacked to my satisfaction. I had to give up on a few features in the name of keeping things stable and easy for the family to use, but it does everything I really wanted it to, and runs smoothly…
This morning, they released the AppleTV 2.1 Update.
I did manage to get Nito TV’s Smart Installer and Turbo’s Kext Loader running in 2.0.2, but the result was a system so jam packed with stuff it wasn’t supposed to do that video play-back suffered badly. Here’s the steps I took, in case anyone else wants to try it:
- Do a clean restore on your AppleTV. Any previous failed hacking attempts will confuse the installer.
- Copy over the Nito TV Installer and run it
sudo bash then
mount -uw / to get write access
- Run Nito TVs Fix Permissions script:
- Make a directory called Documents in ~/
- Copy the 10.4.9 Combo Update into that folder
- Install Turbo’s Kext Loader via the Nito TV UI on your AppleTV
- Run the Smart Installer
- Assuming it succeeds, use a 10.4.9 install to copy the necessary libraries, per these instructions.
- You’ll probably also need to fix permissions on the AppleShare stuff
- Then try a manual mount:
mount_afp -i afp://user:firstname.lastname@example.org/media /Users/frontrow/Movies/
- If that works, you’re in business! Reboot to clear that mount, and check out Sapphire to load content from your mounted folders.
- Finally, install the MPlayer Codecs from the NitoTV UI, then Perian.
Also, I do not recommend using Perian for H.264 decoding. Let the AppleTV built-in stuff do that — seems to work better for me… and once you switch, there’s no easy way to go back.
Now about 2.2 and 2.3…
All of this seems to work on 2.1, 2.2 and 2.3.
In our house, a Mac Mini serves at the content library host. It runs iTunes and shares other media files. At night it runs a number of scheduled tasks to keep things orderly and fresh, and when its done (at about 4:00am) it goes to sleep until 8:00am when my wife will want to use it again.
TwonkyMedia server, which is delivering our non-iTunes content onto the AppleTV (via the MediaCloud uPnP client) has a problem with this. It doesn’t recover well from sleep.
The solution is to run an AppleScript every morning at 8:01 to re-start TwonkyMedia. This little AppleScript will access Twonky’s built-in shell script to shut down any running instances, and start-up a fresh one:
do shell script "/Applications/MediaServer.app/Contents/MacOS/twonkymedia.sh &> /dev/null &"
The “&> /dev/null &” sends the shell script’s output to oblivion so that AppleScript doesn’t hang waiting for the server to start-up.
The only annoying part about this is that every time TwonkyMedia starts up, it wants to take you to its home page in your browser. Follow these directions to make TwonkyMedia start-up silently (last post on the page.)
Just for kicks, I dusted off the old OS/2 Warp discs…
OS/2 was supposed to be the next DOS, developed in co-operation between Microsoft and IBM. Microsoft dropped their end of the deal when Windows 3.0 gained popularity. For awhile, and because they’d shared APIs, IBM was able to run Windows apps within OS/2 Warp, but the compatibility plan wasn’t really in their best interests.
IBM did go on to continue to improve on OS/2 with Warp coming out in 1994 — before Windows 95 was out, adding pre-emptive multi-tasking, improved memory management, and a solid networking stack. But by then Microsoft’s FUD was in effect, and most consumers waited for the next version of Windows.
OS/2 did hold a fair bit of ground in banking and in embedded systems (like ATMs) and although its no longer supported by IBM, a product called eCommstation continues its development and technologies.
Alas, it does not work in VMWare, as they long ago decided support wasn’t worth it. Works fine in VirtualPC, however. This guy has some tips, and you can copy the floppy images right off the CD and use them (without conversion) in VirtualPC.
Once I gave up on VMWare (won’t boot past the second floppy, no matter how I configured the VM) this was one of the easier virtual machines I’ve built. Video was decent at SVGA, sound worked pretty well (the installer likes making funky noises.) Still messing with networking.
Hit the jump for some screen shots…
Continue reading “Virtualizing OS/2 Warp”
Going back to the beginning, and learning Project Builder, Interface Builder and ObjectiveC on NextStep. Can you believe this is the technology that NeXT had the same year Windows 3.1 came out? And its the same stuff that’s used to build Mac and iPhone apps today…
Click for a bigger picture.
In fact, the technology is so close that I used a tutorial for developing a sample Mac app, to develop a sample NextStep app. The notion of “FAT Binaries” that work on multiple hardware architectures came from NeXT as well, since it ran on any number of platforms by the end.
I’ve been hankering to learn more about the origins of OS X, so I figured the best place to start would be the OS at its core — NextStep (later named OpenStep.)
When Steve Jobs was ousted from Apple, he set out to create a new company that would deliver elite hardware, and a revolutionary operating system. NeXT was started to build powerful hardware and software that would leapfrog the Mac (and everyone else on the market.) They eventually had to kill off the hardware line (after making some very nice, uber-high-end machines) but the software they made changed the industry. It was on a NextStation computer, using the NextStep OS that Tim Berners Lee would invent the World Wide Web, and its the true Object Oriented approach of the OS that many companies have imitated or borrowed.
By the mid-90s Apple was in truly rough shape. Their archaic OS, once the greatest thing on the market, was showing its age, and Apple had tried, and failed (mostly due to mismanagement) to replace it. It was determined that they should buy an existing next-gen OS, and re-build on top of it. After flirting with IBM and BeOS, they settled on a deal with NeXT. A deal that grew until Apple acquired the company, re-acquiring Steve Jobs in the process. He became the iCEO (interim CEO) and the de-facto leader of the company. Existing ideas were rapidly brought over from the Mac onto NextStep/OpenStep, layered on top of its rock-solid BSD Mach microkernel, Object Oriented underpinnings, and a re-vamped version of its graphics layer, was a new Interface, and a Classic emulator to allow old Mac apps to run.
The end product, after many variations, pre-releases, betas, and one or two fairly ugly general releases, was what we know today as Mac OS X. Much of NextStep is still intact, including low-level OS APIs, visual and development concepts, and culture.
If you’re interested in getting NextStep up and running in VMWare (I’m using a Windows Vista 64-Bit Host OS, but these steps should work with most versions of VMWare — including Fusion) you’ll need to find an ISO of the NextStep OS somewhere, and maybe these steps will help you…
Continue reading “Installing NextStep 3.3 on VMWare 6”