• 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: Running AppleScripts from Users CronTab [was (no subject)]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running AppleScripts from Users CronTab [was (no subject)]


  • Subject: Re: Running AppleScripts from Users CronTab [was (no subject)]
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 16 Nov 2005 08:45:22 -0800

On Nov 15, 2005, at 6:48 PM, Malcolm Fitzgerald wrote:

On 11/15/05 3:46 PM, "Malcolm Fitzgerald" <email@hidden> wrote:

I'm having trouble getting cron to perform an applescript. ...

On 16/11/2005, at 12:41 PM, Andrew Oliver wrote:

You AppleScript tried to attach to the UI server but it isn't permitted to
do so, presumably because the account in question was not logged in at the
time.

That's right.

There are some very specific issues about attaching to WindowServer, and
AppleScripts seem to try to attach even when there's no apparent reason to
do so (e.g. no user interaction required).


Your solution is to either ensure you're logged in at the time the script
runs, or add the script to the root crontab (root can attach to the
WindowServer even when it isn't logged in).

Hmm, I'm only on this machine several times a week. I want this job to run daily. Most times that it runs I'll not be logged in. Sometimes no one will be logged in.


If I run the job via root's crontab how will I handle permissions? I'd like the output to be stored in my user space with my permissions but I imagine that a job run as root will produce files that are owned by root.

That's correct. There are user-specific crontabs, but they run using an effective uid of that user, so then you're back to the original problem.


In general, AppleScript does not work well with no logged-in user, or from outside the currently logged-in user's "space" -- some of it has to do with historical baggage, some of it has to do with fundamental restrictions (if there's no one logged in, you aren't allowed to launch applications, which restricts AppleScript dramatically). Your choices are to leave someone logged in and use a more user-level tool like Cronnix, or to write your script using a more cron-friendly language such as bash or Python. If you explained what you're trying to do, someone here might write the script for you. =)


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Running AppleScripts from Users CronTab
      • From: Doug McNutt <email@hidden>
References: 
 >Re: (no subject) (From: Andrew Oliver <email@hidden>)
 >Running AppleScripts from Users CronTab [was (no subject)] (From: Malcolm Fitzgerald <email@hidden>)

  • Prev by Date: Set type preferences in InDesign
  • Next by Date: Re: Web text to word
  • Previous by thread: Running AppleScripts from Users CronTab [was (no subject)]
  • Next by thread: Re: Running AppleScripts from Users CronTab
  • Index(es):
    • Date
    • Thread