• 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: Setting up a cron job
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting up a cron job


  • Subject: Re: Setting up a cron job
  • From: Graff <email@hidden>
  • Date: Tue, 25 May 2004 14:23:56 -0400

The command "/usr/bin/osascript -e" runs the shell tool "osascript" which will take an AppleScript (or any other OSA-compliant script) and execute it. The "-e" flag takes a string and treats it as an AppleScript. You can use multiple "-e" flags for multi-line scripts.

For example, this AppleScript,
----
tell application "Finder"
display dialog "HI!"
end tell
----

could be run from the command line by doing:

/usr/bin/osascript -e 'tell application "Finder"' -e 'display dialog "HI!"' -e "end tell"

You could also save the script as a plain text file or a compiled script and then have osascript execute the commands out of that. Say you saved the script as a compiled script file to ~/Library/Scripts/thescript.scpt. You could then execute it from the shell by doing:

/usr/bin/osascript ~/Library/Scripts/thescript.scpt


So basically osascript is the way to run an AppleScript from the command line or through a shell tool such as cron. To find out more about it type this from the command line:

man osascript

- Ken

On May 25, 2004, at 12:02 PM, Steven Valenti wrote:

CronniX looked fairly simple so I gave it a try. I found an example that Sal Soghoian has at <http://www.koch-schmidt.de/cronnix/> and this worked for me. I set up the command the same way for my back up script ... /usr/bin/osascript -e 'run script alias ((path to scripts folder from user domain as string) & "BackUp Script.scpt")'

Can someone explain what "/usr/bin/osascript -e" does? Is there any other way to word this command?
Sorry if this is a simple question. Just want to know why I'm putting this in front of my path to script.

On Tuesday, May 25, 2004, at 11:18 AM, de Runtz, Lars wrote:

crontab -u <user> -e

Then you enter arguments for minute hour day month weekday path/shellscript, example:
0 * * * * /Users/user/hourlyscript

would run every hour.

look in the man page, or google "crontab"

-Lars DeRuntz
SalesLink
Newark, CA

-----Original Message-----
From: Steven Valenti [mailto:email@hidden]
Sent: Monday, May 24, 2004 1:12 PM
To: email@hidden
Subject: Setting up a cron job


I would like to schedule a back-up script to run weekdays starting at
9 PM. I have never set up a cron job before. I understand how the
daily/weekly/monthly/ect...... is organized. Looking in terminal I can
see Norton software has already put some tasks in the Users crontab,
but how now do I open this in Pico to edit it? If I can edit it, can I
just type a path, under the command, to an applescript compiled file
anywhere on the drive. Do I need to set the computer to never go to
sleep or is there a way to wake it before cron is run? If cron is all I
need I would prefer learning rather then getting other software to do
this job. Does anyone know of sites that could give me more information
to get started?

Thanks
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Re: Setting up a cron job (From: Steven Valenti <email@hidden>)

  • Prev by Date: RE : Variable renaming and managing a folder
  • Next by Date: Re: Disabling Rendezvous - SOLVED
  • Previous by thread: Re: Setting up a cron job
  • Next by thread: Problem activating a script from within FileMaker 6
  • Index(es):
    • Date
    • Thread