how to restart OSX every 3 hours automatically

Energy saver lets me do a restart every day.
I need to do a restart every few hours on a remote TiBook G4 running OSX10.4.11 (Tiger).
There is no body around to restart the computer when a certain program (Skype) crashes so I want to force a restart every few hours.
Anyone have tips?

not counting work over the years more than 20 Macs and 3 PCs, Mac OS X (10.5.7), iMacs, TiBook. 1st-4th Generation iPods, some iBooks, Newton, parade of peeseez

Posted on Jul 10, 2009 2:35 AM

Reply
21 replies

Jul 10, 2009 2:01 PM in response to dgd

Have at look at this, It is no longer being supported but I have used it for a number of years with no problem.
http://tuppis.com/lingon/
You could probably reboot the machine with this from a terminal script or perhaps a cleaner mode would be to check using a script every so often if Skype is running then do nothing, if not running start Skype.

I used it to backup the OD database every night, never failed.

Jul 10, 2009 10:29 PM in response to dgd

Just to clarify, when the Skype program crashes, does the whole machine also crash and you have to restart the computer, rather than just relaunch Skype? Are you running the latest version of Skype for Tiger?

If nobody is around, why do you need to leave Skype running if it is crash prone on that machine? Just trying to understand the situation a little better to see if there might be any alternative approaches to consider.

Jul 10, 2009 10:51 PM in response to Glen Doggett

Only Skype crashes. It seems to crash when the other party ends the call. The rest of the System is fine, though my energy saver scheduled restarts do not restart while the 'Skype Has Unexpectedly Quit" acknowledge button is on the screen.

Just forcing a hard restart will solve all my issues with being able to have remote Skype access to this Mac. I travel lots to other countries and the people in my "baby room" are not technically capable of helping.

Skype is set to auto answer incoming calls from only those on the contact list.

I am using it as a baby room monitor. Skype has sound which many other video monitoring programs do not. And it has higher resolution than yahoo or sightspeed especially since I can hack it slightly to keep the resolution up.

The machine Skype is running on is a TiBook G4 1Ghz with OSX10.4.11 and Skype is version 2.7.0.330 the latest. The only other program running at the same time is Activity Monitor.

Thanks for any advice you can offer.

Jul 11, 2009 5:58 AM in response to dgd

Try this - tested on Leopard but will probably work in Tiger.

Copy the following into the AppleScript Editor:

property rstr : ""
on run
set rstr to 1
repeat until rstr is greater than 180
set cdwn to (181 - rstr)
tell me
activate
display dialog "Press Cancel to quit" & return & " " & return & "Restart in " & cdwn & " minutes" buttons {"Cancel"} default button "Cancel" giving up after 60
end tell
set rstr to (rstr + 1)
end repeat
tell application "Finder"
restart
end tell
end run


(end of script)
Save it as an Application, making sure 'Run only', 'Startup Screen' and 'Stay open' are not checked. Place the script somewhere convenient, then go to System Preferences>Accounts>Login items and set it as a startup item (so that it will survive the restart).

It will display a dialog box with a countdown in minutes and a cancel button to quit it. It will run in the foreground, but Skype will run happily in the background.

At the end of 3 hours it will restart the computer: of course if you have any unsaved documents open (which it appears you don't plan on) that would hang the restart.

If you don't like the dialog box in the foreground, this script should work:

delay (10800)
tell application "Finder"
restart
end tell

however note that you can't quit it: you can only do so by using command-option-escape to force quit it; but it will run in the background.

Jul 11, 2009 7:52 AM in response to dgd

Thanks for the details, here's a couple of suggestions that might help you deal with this situation:

Okey Dokey can dismiss the dialog box after a specified amount of time
http://www.versiontracker.com/dyn/moreinfo/macos/16438

If you want to use Skype like a monitor, then you just need the ability to connect to the computer and get Skype up and running again, so maybe try Chicken of the VNC or Tight VNC. These Virtual Network Computer clients let you open a window on any remote computer (PC/Mac/Linux) and view/control the home computer.
http://www.apple.com/downloads/macosx/networking_security/chickenofthevnc.html
http://www.tightvnc.com/

Jul 11, 2009 8:15 AM in response to Glen Doggett

Okie Dokey looks like it might help with clearing the dialog box that pops up when a program quits unexpectedly.
I use Chickenofthevnc and tightvnc often. Though my difficulty with these is testing them from an outside network. I usually have to drive around to find an unsecured wifi to make sure I've opened the ports correctly on my home router.

Jul 11, 2009 8:25 AM in response to dgd

Will the script you gave still do the restart even though there is an open dialog box from Skype having quit and wanting to report to Apple?


I don't know: possibly not - it's possible that just quitting Skype will clear the box. As my Skype isn't crashing I can't test it. If you want a quick test just wait for it to crash and then run

tell application "Finder"
restart
end tell

you could add

tell application "Skype" to quit

before that but it may not be necessary.

Incidentally, QuicKeys would be able to check for the presence of the 'report to Apple' at short intervals and if it found it could close the box and reboot Skype without needing to reboot the computer: of course it costs money.

Jul 11, 2009 8:36 AM in response to dgd

Applications>AppleScript>Script Editor

Just paste the script in, from the File menu choose 'Save As'. Give it a name and choose a location: Set 'File Format' to 'Application', and make sure 'Run Only'. 'Startup Screen' and 'Stay Open' are not checked. You don't need Automator.

When you'ved saved the script somewhere, you can set it to run on startup as I described above.

Jul 25, 2009 12:17 PM in response to dgd

i know this is a bit of a cave-man approach, but if you can't find a 'proper' way to do this, couldn't you just plug the computer into an electronic timer which switches off and on again every 3 hours (the kind you use for lights to keep burglars away) then you can set the preference for computer to automatically restart every tie the power cuts out.

you'd also need to probably unplug the battery if it's a powerbook rather than a desktop.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how to restart OSX every 3 hours automatically

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.