Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use sleepwatcher to manage sleep and shared volumes Network
I pretty much always have my home file server mounted via samba (automount/dynamic) on my laptop. The problem is that samba and other network shares usually don't play nice after a sleep, causing me to manually remount the shares. This is especially the case when my ip changes. My solution is to use the sleepwatcher daemon (download) to run commands just before sleep and after wake.

By unmounting your network shares just before sleep, your system won't have to deal with lost connections when it wakes up. Additionally, when your system wakes up, the sleepwatcher daemon will run your wakeup script, which can remount your network shares. sleepwatcher daemon Here are the steps:
  1. Install sleepwatcher.

  2. Make a shell script in your home directory named .sleep. I just unmount my network mounts in this script. Make sure you chmod it to at least 700; 755 is OK, too. Here's the script:
    logger -t sleepwatcher "unmounting serv"
    umount /Network/Servers/servh/data
  3. Make a shell script in your home directory named .wakup. Since this script might run before the network comes back up, I use a trick to pipe the command to a backgrounded bash prompt with a sleep 10 command. chmod this one to 700 or 755 as well:
    echo 'sleep 10
    logger -t sleepwatcher "remounting serv"
    ls /Network/Servers/servh/data' | /bin/sh&
The logger lines help you see what's going in system.log. Since my mount is dynamic, a simple ls is enough to tell automount to mount it.
  Post a comment  •  Comments (4)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
[17,936 views]  View Printable Version
10.4: Retrieve WAN IP via script and Automator Network
I often access my G5 and my home network at large from the office. The problem is my bad connection, NAT, and not having a static IP. It's usually good enough that I only have to check my WAN IP address once a day. The problem is I'm going on vacation for a while, and would like to be able to 'check in.' So, between my abysmal scripting and Automator skills, I think I've got something worked out.

So, the first thing is a bash script that goes out to the web and gets the IP address of the machine it's running on. If things worked, it will print a message saying:
Here's the current IP Information for DuoBook

As far as I can tell everything ran fine.
Next, I compiled an Automator workflow (download) into an application to email me that output, and clean up the temp files. It's running in a cron job.

It seems to be running fine, although, like I said my scripting / Automator skills are terrible, so it could break. If anyone sees anything wrong, could you let me know before I leave for that vacation. You'll have to tweak the workflow, as it's got my email built in, and it relies on knowing where the script is.
  Post a comment  •  Comments (13)  
  • Currently 2.00 / 5
  You rated: 5 / 5 (5 votes cast)
[20,958 views]  View Printable Version
Create a wireless speaker setup without AirTunes Network
I listen to music quite often on my PowerBook whilst studying, but, like most people, I find hearing it through the built-in speakers sacrilege. Aside from setting up my desk next to a stereo, the first solution that comes to mind is Apple's AirPort Express with Airtunes; this is essentially a wireless router that has a connection to your stereo, and has the ability to play audio from iTunes. This all comes at a price, however.

The following guide will show you how to live the champagne lifestyle on a cask-wine budget (at least with respect to your audio setup).

The solution

Thanks to the efforts of hard working and hospitable geeks, a free, open-source solution is at hand -- and has been since about 1998. Its name is the Enlightenment Sound Daemon (esd). The Enlightenment Sound Daemon is essentially a network-transparent audio protocol, in many ways is analagous to X11 with graphics (if you don't know what X11 is, then you're probably not geeky enough for this tutorial -- buy an AirPort Express).
read more (479 words)   Post a comment  •  Comments (13)  
  • Currently 2.71 / 5
  You rated: 1 / 5 (7 votes cast)
[113,169 views]  View Printable Version
Another fix for error -5000 on Windows 2003 Server Network
Just to post a follow-up for people who were trying to connect to a standard install of WinServer 2003, and were unable to do so, due to error -5000. I was getting errors every time, regardless of the user settings.

The referenced hint above requires you to downgrade the security settings on the server. Instead, I changed one line in the file /etc/smb.conf/. Change the line that reads:
  client ntlmv2 auth = no
to this:
  client ntlmv2 auth = yes
After making this change, it works again. No need to restart or anything. This may not work for everyone, but it does solve the issue for me.
  Post a comment  •  Comments (2)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[7,945 views]  View Printable Version
Fix Open/Save dialog delays caused by local iDisk Network
The iDisk feature of .Mac can be very useful, however it seems to be plauged by slow speeds (I find it impossible to use without the local iDisk turned on) and sync issues (automatic sync causes corrupted files in some apps). Even with auto-syncing off, open/save dialogs and even opening Finder windows can cause a spinning rainbow cursor; sometimes for over a minute.

The problem lies in the fact that the local iDisk (stored in /Volumes/iDisk) has symbolic links (aliases) to folders on the remote iDisk (/Volumes/your_mac.com_name). When OS X lists the local iDisk's contents, info for these folders must be loaded from the remote iDisk, which can take some time. The Open and Save dialogs are particularly bad if they default to a location on the local iDisk, because the column view that displays the files and folders includes the alias folders at the root of the local iDisk.

As some people have noted, the problem gets better after the first incident. This is because OS X is kind enough to cache the remote folder info. However, I have found that the problem can persist and present itself in various ways.
read more (222 words)   Post a comment  •  Comments (4)  
  • Currently 1.67 / 5
  You rated: 2 / 5 (3 votes cast)
[12,385 views]  View Printable Version
Prevent unwanted host sleep while networked Network
With the new child in the house, I've lately found myself working in many locations at many odd hours of the night. The end result is that my 12" PowerBook is getting a lot of exercise lately, including a lot of hint writing and editing. (And it's also making me yearn for a 15" Core Duo machine; as much as I love travelling with my 12" PB, it's not the ideal machine from which to work remotely within the house. The lack of pixels leads to too much reliance on Exposť to help get things done.)

My Dual G5 desktop runs a local copy of Geeklog, so I do all the previewing and editing of stories from its database on the G5. When working on the PB, I enter the G5's IP address to load the submitted stories, preview my edits, and then publish to the G5. (Later on, I dump the SQL data files from the G5 and upload to the web server to publish the hints.)

I was doing this the other evening when the G5 suddenly stopped serving pages. So I put down the PB, walked over to the den, and found that the G5 had decided it was time for its pre-set "sleep if idle for 30 minutes" timeout. But clearly the machine wasn't idle -- it was serving web pages to the PowerBook. I guess, though, from the system's perspective, this didn't show as activity as far as the sleep schedule was concerned (no mouse movement or screen updates).

I didn't really want to disable sleep on the G5, so after a bit of expermentation, I found the solution: to keep a networked machine awake, you simply have to connect to it via file sharing. On the PowerBook, I mounted my home directory from the G5, and went back to work. Hours later, the G5 was still awake. I unmounted the drive when I was done, and the G5 fell asleep again as scheduled.

I assume there are other tricks to keeping a "non active" networked machine awake (setting a cron task to do something every so many minutes?), but this one worked for me.
  Post a comment  •  Comments (7)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
[6,320 views]  View Printable Version
A script to automate Cisco Clean Access logins Network
I'm currently a student at Davidson College. The school currently protects its network with a program called Cisco Clean Access. A compulsory client exists for XP machines that enforces all sorts of local policies (like running a virus scanner) before automatically providing the machine access to the campus network after the user provides their login name and password.

On non-XP machines, a user has to provide their credentials via a web-based form before access to the network is granted. I have a MacBook Pro, and I've gotten really sick of having to re-login to the campus network (both Ethernet and wifi) via this webform every time my computer goes to sleep or I change locations. So, I've managed to write a bash script that uses curl to log me in through the web forms.

Thanks to some amazing work by macrumors forum member Wombert, I've also found a way to have it activate automatically, any time the campus wifi network SSID is detected. This automation avoids heavy-handed cron jobs by leveraging two OS X features, configd and Kicker.xml. (There's a previous hint here that relies on AppleScript and iCal scheduling.)

Now the script and Kicker.xml transparently log me onto our campus network, and hence the internet, any time my computer senses a preset group of SSIDs. The curl commands are specific to Cisco Clean Access, but they could easily be adapted to other environments where users must login through web forms, making this script potentially broadly useful.

One downside to the script right now is that it stores the username and password in plaintext. Perhaps someone could make this part more secure with more sophisticated code. Instructions are included in the comments of the script. To use the script, just copy and paste into a .sh file, and make it executable. You can also see it all marked up at

[robg adds: I have not tested this one...]
  Post a comment  •  Comments (6)  
  • Currently 2.67 / 5
  You rated: 5 / 5 (6 votes cast)
[17,609 views]  View Printable Version
10.4: Change firewall rules for system Sharing services Network
Tiger only hintAfter using OSXvnc for a while I installed Apple Remote Desktop client 2.1 because I have two screens. Chicken of the VNC to ARD works great (though slowly) as long as I do not choose 8-bit mode and remember to send a password. That is not the problem. The problem is that I had OSXvnc working over ssh, but ARD added a firewall entry for itself that opens ports 5900 and 3283 every time I start it. This was a general problem for me; I did not like how enabling a service would open ports for it in the firewall, since I forward everything I can over ssh. In 10.3, I had a startup item that would configure ipfw itself, but you are supposed to use launchd in 10.4. So I decided I would figure out how to not have ports open automatically when I start a service.

[kirkmc adds: I had a bit of a problem testing this hint (well, at least verifying the steps; I didn't fully test it). The author mentions expanding "udport" in the plist file in Property List Editor, but I didn't find that key. I tried activating ARD VNC access, and setting a user and password, but the key still didn't show up.

By iChat, I asked Rob if he had it, and indeed he does. I don't know why there is a difference, so if you don't see it, well, I don't know what to suggest. Since this ARD access is a system function - you don't need to have a copy of ARD installed - there's no reason why one Tiger system would have it and another wouldn't.]
read more (703 words)   Post a comment  •  Comments (5)  
  • Currently 1.67 / 5
  You rated: 1 / 5 (6 votes cast)
[20,255 views]  View Printable Version
Share a Mac DVD drive to a Windows PC Network
My daughter bought a cheap Windows PC a couple of years back to play the online game Final Fantasy XI. The company recently released a game expansion, but the software is on a DVD and her computer does not have a DVD drive. After trying to share the DVD drive from another PC and failing, we gave up on a pure Windows solution.

So we put the DVD in my Mac laptop's drive, and after it mounted, I opened Terminal and created a Unix link in my public directory to the DVD.

cd ~/Public
ln -s /Volumes/FFXI

Once her PC located the shared drive on my Mac, she could install the software as if the DVD drive was part of her computer.
  Post a comment  •  Comments (14)  
  • Currently 3.67 / 5
  You rated: 4 / 5 (6 votes cast)
[59,747 views]  View Printable Version
Windows printing off a Mac-connected USB printer Network
Here is a hint that may save you some trouble figuring out how to print from your Windows machines to a Mac-connected printer. There have been some really good suggestions on this website, so I tried to put all the info together in one hint (though it's probably still not comprehensive).

I have one desktop PC, one laptop PC, and a Mac mini connected on my home network. My Mac is running the show, and so, my printer is connected via USB to this machine. So my problem was to figure out how to print off the other two PCs to my Canon i960.

The key software you want on your PC to make life good is Bonjour for Windows (it's linked at the bottom right of that page). Get this, and you are gold. When specifing your printer on your Windows machine, do not select your own printer (ie. my Canon i960). Instead, go with Generic Postscript.

Here are some simple steps that I compiled. First install the printer drivers on your PC and Mac. Download and install bonjour on your PC.

On the Mac:
  1. Go to System Preferences and open Print & Fax.
  2. Check to see if your printer is installed (ie. mine shows i960).
  3. Go to the Sharing preferences panel.
  4. Check the following: Windows sharing, and Printer sharing.
On the PC:
  1. Install Bonjour.
  2. Follow the steps for setting up Bonjour.
  3. Once you have found your shared printer on the network and it asks you to specify the driver, go with the Generic Postscript.
And, pretty much at that point, I was printing. Hope this works for you.
  Post a comment  •  Comments (23)  
  • Currently 4.09 / 5
  You rated: 5 / 5 (11 votes cast)
[88,298 views]  View Printable Version