2

My son spends hours on Star Wars Galaxies. Does anybody knows how to shutdown automatically the Mac after one hour of gaming and to let it turn on again only after some time?

I tried to identify the executable in a top command but I do not master enough shell and crontab to do something useful.

Best

1
  • 1
    A managed account (parental controls) can set time limits, but that would apply regardless of if he was gaming or not. How about having two accounts for your son, both with parental controls? One could have a time limit set, and is able to (only?) run the game, while the other doesn't have a time limit, but limits the available applications so the game can not run. Then he could play the game a set amount of time each day, but still have access to the computer for other things such as homework (wishful thinking?)
    – D.G.
    Feb 6 '15 at 23:13
1

The answer to this question will shutdown at a certain time How can I forcibly shut down my Mac at an appointed time? but that is not exactly what you asked for, although it is non-cancellable (well, not easily anyway) and walks you through the use of cron.

You can also achieve the same thing in the Energy Saver control panel, by clicking the Schedule... button.

To shutdown, after a certain time, there is a free application called Shutdown Timer which usefully gives a half-time reminder.

Finally, here is a non-cancellable AppleScript, from An AppleScript to generate a timed shutdown

(* how many seconds before we remove the notice? *)
property dialog_timeout : 3

repeat
  try
    display dialog "In how many minutes must the computer be shutdown?" ¬
    default answer ""
    set the time_amount to the text returned of the result as integer
    if the time_amount is greater than 0 then exit repeat
    on error number error_number
    if the error_number is -128 then return "user cancelled"
  end try
end repeat

if the time_amount is 1 then
  set the my_minuten to "minute"
else
  set the my_minuten to "minutes"
end if

display dialog "The computer will be shutdown in " & time_amount & " " & ¬
my_minuten & "!" buttons {"Ok"} default button 1 giving up after dialog_timeout

delay time_amount * 60
tell application "Finder" to shut down

However, none of these options keep the machine turned off for a specific set time, so they only answer half of your question, unfortunately. Maybe managed parental accounts, as suggested by D.G., are the way to go... See OS X Mavericks: Set up parental controls

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .