• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crontab message to user
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crontab message to user


  • Subject: Re: Crontab message to user
  • From: Joshua See <email@hidden>
  • Date: Tue, 27 May 2003 10:10:17 -0500

On Friday, May 23, 2003, at 08:38 AM, Dan Ball wrote:

We have our machines shutdown every night at 11:00pm, we are currently using
OS 9 which is easy to do.

We want to do this with OS X when we move to it. I have a Crontab to
/sbin/shutdown -h now at 11:00 everyday.

How could I get a GUI message to pop up saying at like 10:55pm to warn a
logged in user that the system is going to shutdown at 11:00pm, please save
all your work before that time.

Probably would be nice to let the user cancel it also!

You could move your cronjob up five minutes and add this line:

osascript -e 'tell app "Finder" to display dialog "It is time for this computer to shutdown. Save your work and get some sleep." with icon 1 buttons {"Shutdown", "Cancel"} default button 1 giving up after 300'

Clicking "Cancel" will produce an exit status of 1. "Shutdown" or a timeout will exit 0. The tell gets around the osascript interactivity restrictions, and lets the dialog be put in the background so the user can save. If you don't like the pop under tendencies of the dialog, have fun with quoted form and convert the tell line into a tell block, adding an activate command.
--
Sincerely,
Joshua See
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Crontab message to user
      • From: Lewis Butler <email@hidden>
    • Re: Crontab message to user
      • From: Michael Stoll <email@hidden>
References: 
 >Crontab message to user (From: Dan Ball <email@hidden>)

  • Prev by Date: iTunes Library -> HTML
  • Next by Date: Re: Crontab message to user
  • Previous by thread: Re: Crontab message to user
  • Next by thread: Re: Crontab message to user
  • Index(es):
    • Date
    • Thread