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

Automatically reconnect iChat if connection drops Apps
I've had the problem with my iChat Jabber connections (gtalk and yahoo.jabber.org.uk gateway) constantly crashing, causing an error dialog in iChat. Since the Chax add-on no longer seems to support automatically reconnecting to crashed connections in 10.5, I found this great idea for a crontab script to force a reconnection using AppleScript. However, the only problem is that this would start iChat even if it was not running.

So I used this slightly extended script to make it check if iChat was running before executing the login command. I added this line to my crontab (via crontab -e or the Cronnix crontab editor) to make it re-run every minute using the command line:
* * * * * osascript -e 'tell application "System Events" to if (processes whose name is "iChat") exists then tell application "iChat" to log in'
Hopefully they'll add this back into Chax, or even iChat itself, as it's a seemingly basic function.

[robg adds: I haven't tested this one.]
    •    
  • Currently 3.30 / 5
  You rated: 5 / 5 (10 votes cast)
 
[13,241 views]  

Automatically reconnect iChat if connection drops | 6 comments | Create New Account
Click here to return to the 'Automatically reconnect iChat if connection drops' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automatically reconnect iChat if connection drops
Authored by: enthooz on Mar 20, '10 02:59:12PM
This still works in 10.6 but AFAIK, the crontab file must be edited directly at /var/at/tabs/[username]. Also, one annoying thing is that it sends repeated emails to your system account. Anyone know how to prevent this?

[ Reply to This | # ]
Automatically reconnect iChat if connection drops
Authored by: enthooz on May 26, '10 12:30:08PM

Resolved.

This occurs because cron automatically sends the output of a command to the user's mailbox.

To fix this, add ` > /dev/null 2>&1` to the end of the line. The new line looks like this:

* * * * * osascript -e 'tell application "System Events" to if (processes whose name is "iChat") exists then tell application "iChat" to log in' > /dev/null 2>&1

Source: http://forums.macosxhints.com/archive/index.php/t-40060.html



[ Reply to This | # ]
Automatically reconnect iChat if connection drops
Authored by: bankshot on Nov 02, '10 11:19:22AM

On my Snow Leopard machine, osascript complains about certain Adobe scripting additions not being universal (I must have gotten these from installing Photoshop Elements?). This happens because osascript normally runs as x86_64, but the Adobe additions only include i386 and ppc architectures. It is these complaints that would generate the cron emails.

Another way to get rid of the messages is to run osascript specifically using the i386 architecture:

* * * * * arch -i386 osascript -e 'tell application "System Events" to if (processes whose name is "iChat") exists then tell application "iChat" to log in'

The nice thing about this approach is you'll still get an email if something else goes wrong (which should be rare).

Also, you should always use crontab -e to edit the crontab; never edit the file directly.



[ Reply to This | # ]
Automatically reconnect iChat if connection drops
Authored by: enthooz on Nov 02, '10 02:54:08PM

Nice find! Thanks.

Do you have any issues with this causing your machine to "hesitate" when you tell it to sleep?



[ Reply to This | # ]
Automatically reconnect iChat if connection drops
Authored by: bankshot on Nov 26, '10 12:29:07PM

Hmm, I wouldn't know, as I never sleep the machine (it's a Mac mini that runs 24/7 as my home server as well as my primary desktop).

By the way, the arch -i386 stuff isn't needed if you download Adobe's latest version of their scripting additions (assuming the Adobe stuff was the culprit). They have a knowledge base article here:

http://kb2.adobe.com/cps/516/cpsid_51615.html



[ Reply to This | # ]
Automatically reconnect iChat if connection drops
Authored by: macinthass on Feb 23, '12 07:56:54AM

Anyone knows if this still works with Lion and Messages Beta or iChat?

Where exactly do I need to put the script. What event triggers it? Do I need to set an event trigger in iChat?



[ Reply to This | # ]