• 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 doesn't work for me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crontab doesn't work for me


  • Subject: Re: Crontab doesn't work for me
  • From: Bernardo Hoehl / Gessos Rutenium <email@hidden>
  • Date: Tue, 21 Sep 2004 20:29:44 -0300

Hi Folks!


I have some of my applications running from Cron, and they all work fine.


Make an entry on your Cron for this shell script:

#!/bin/sh
open /path/to/your app. (path to your applescript app)

Don't forget to save the applescript as an "application"

Don't forget to start your applet with this:

Tell application "System Events"
keystroke "return"
end tell

The code above will avoid the applet from crashing, actually it will bring your computer from the screensaver condition it may be when you try to run your applet from the shell script activated by Cron.

Don't know 100% why. But this works here for me.

Hope this helps...


Bernardo Rio de Janeiro - Brazil



On 21 Sep, 2004, at 8:15 PM, Brian Johnson wrote:



On Tue, 21 Sep 2004, Dan Doughtie wrote:

Using the example from Ethan Wilde¹s book on AppleScript For Applications I
created a cron job that is supposed to run a compiled Applescript that
basically tells an app to activate. (page 68)

Welcome to the "you can't run Applescripts in a shell universe" problem. Shell scripts that use osascript will die a horrible death if they aren't run from a window'ed environment (under the control of "Window Server"). If you check your system log I think you'll find your script crashing each time cron launches it.


The "open -a" suggestion might work for Entourage, but it won't run the script (I don't think) for much the same reason.

I bumped into this myself a while back (you can't use php EXEC commands to run applescripts either -- same reason, and this is part of why apache won't run applescripts without help) and eventually put together a partial solution (not guaranteed for all situations....) It's called 'peacePipe' (look online at quicksilver.caup.washington.edu/software) and it creates a tunnel between the shell universe and a logged-in user universe using sockets (and blah blah). The upshot of it is that you can run a shell script in cron that talks through the pipe to your applescript applications (and potentially gets results back). Unfortunately, I haven't gotten around to documenting how you do this easily, so write to me privately if you decide you need to do this and someone else doesn't suggest a better way.

Brian Johnson, Dept of Architecture, University of Washington, Seattle _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden
_______________________________________________
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


References: 
 >Crontab doesn't work for me (From: Dan Doughtie <email@hidden>)
 >Re: Crontab doesn't work for me (From: Brian Johnson <email@hidden>)

  • Prev by Date: Re: Crontab doesn't work for me
  • Next by Date: Re: Crontab doesn't work for me
  • Previous by thread: Re: Crontab doesn't work for me
  • Next by thread: Re: Crontab doesn't work for me
  • Index(es):
    • Date
    • Thread