If you use a Yahoo IM account in Messages and have a MacBook, you'll find your Yahoo account won't go back online whenever the Mac awakes from sleep mode. Apparently, AOL IM accounts are affected in this way too. Here's one simple solution to the problem that uses crontab to run a simple Applescript that periodically takes all the accounts online.
I write more about this on my blog, including a couple of caveats, but here are the basic steps:
1. Ensure Messages starts at login by right-clicking its Dock icon and Options > Open at Login. Remember that, in OS X Mountain Lion, apps not used for a while will appear to quit automatically, but don’t worry — these steps take that into account.
2. Open a Terminal window. You’ll find Terminal in the Utilities folder of the Applications list within Finder.
3. At the command-line prompt, type crontab -e
4. This will open your (probably) empty crontab file within the vi text editor. Press I to switch to insert mode, so you can type text. Then copy and paste the following, which is all one line:
*/15 * * * * osascript -e 'tell application "System Events" to tell application "Messages" to log in'
Note that if you copy and paste the line, the quotation/single quote marks might be “curly,” depending on which browser you use. This will stop the command working. You might need to delete the quotes, then type them again using your keyboard.
The command causes the AppleScript we specify to run every 15 minutes, which seems reasonable to me because I became a little wary that any more frequent running of the command might impact battery life of my MacBook. But you can change the 15 at the start of the line to any other value, such as 5 minutes.
5. Press Escape, then type :wq which will save the file and quit the editor.
That’s it. You can test it however you wish. Perhaps you might want to take all your accounts offline, then wait up to 15 minutes to find that you’re back online automatically in the background.
Mac OS X Hints
http://hints.macworld.com/article.php?story=2012121810212698