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


Click here to return to the 'Set iChat status according to physical location' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set iChat status according to physical location
Authored by: jonbauman on Apr 27, '04 12:35:39PM
I'm not a big fan of keeping scripts running all the time, either.

After using my own script this way for awhile, I've decided that I'm not a big fan of it either. For no reason that I could determine, it just seemed to stop executing the idle loop after running for a couple of days. It's no problem though, the same script runs like a dream with cron. For those of you who don't feel like digging through man pages, here's how to set it up.

  1. Make sure your EDITOR environment variable is set to something you can use. For me this is emacs. Under bash a command like export EDITOR=`which applicationName` will do the trick.
  2. run crontab -e to edit your user-specific crontab file.
  3. To the first line of the file, add PATH=/bin:/sbin:/usr/bin:/usr/sbin. This is so the commands in the script like perl, ioreg and ifconfig can be executed without specifying their full paths, but it's a nice thing to have in your crontab in general.
  4. Add this line: * * * * * /usr/bin/osascript "/path/to/script" >& /dev/null
  5. Save your changes and quit your editor. Unless you messed up, you should see the message: crontab: installing new crontab.

This setup will run the script once a minute, which I think is reasonable. If you want to make it run less often, you can replace the first asterisk with "*/N" to make it run every N minutes. For a full explanation of the crontab file format run man 5 crontab.

---

jon

[ Reply to This | # ]