Cronnix users

Eh, hem… first off that titile is Cronnix users… not Chronic users!

Ok…

I have Cronnix and am using it for the first time to launch an apple script every 10 minutes.

I have set it up so that in the simple tab I have 10 entered in the minutes row and check marks for everything else.

The command reads: osascript ~/Documents/screencap_run.scpt

When I utilize the “run script now fuctionality” the script runs perfectly. I save the edits and quit Cronnix and the script never appears to run.

So, the question is, does Cronnix require a system restart to start utilizing the sript?

Hi,

What I do is just insert a program (script application). The command looks like this with my AppleScript script application located on my desktop:

/usr/bin/open /Users/kel/Desktop/SayTime

Or I think you can just drag your script application into the CronniX window. I think of the asterisk as “every”. So if I wanted every 10 minutes, then in the minutes column I would enter:

*/10

which tells it to set up a crontab to run my script app “SayTime” every 10 minutes and all the other fields are asterisks (for every hour, every day, etc.).

As soon as you save your crontab settings it should begin waiting for the time to run your script.

gl,

Kel’s instructions will get you running every 10 minutes. Just so you know the difference, the notation you used would be appropriate if you wanted to run 10 minutes after the hour. Get it?

Hi again,

Don’t know if this is the proper way to do it, but I got it to run a Compiled Sript by changing the ‘open’ to ‘osascript’ like this:

/usr/bin/osascript /Users/kel/Desktop/SayTimeCompile

gl,

:x ggggrrrrrrrrr… :evil:

Ok, this is aggrevating because it should be so bleeping simple.

Here is the screen shot of my tab…
And yes, I am aware that earlier I stated I wanted it to to run every 10 min but for testing purposes - I have tossed in a 2.
Thanks, by the way, for the tip on the “*/”!

Again, if I utilze the run now feature, the script runs perfectly. The Cronnix tab, once saved, does nothing.

If I use the /usr/bin/open option rather than osascript - the script appears to be called, because ScriptEditor launches (although it is not told to in the script) and the sequence stops. The script does not appear to process.

I just tried the /usr/bin/osascript option rather than the /usr/bin/open or simply osascript & that doesn’t appear to do anything.

Just for info purposes - here is the script that I am calling.


tell application "System Events" to set isRunning to exists process "Camino"

if isRunning is true then
	--Get Date in form MMDDHHMM - hours & minutes in Military Time 
	set theDate to (do shell script "date "+%m%d%H%M"")
	
	--define folder to save files in
	set save_location to "Macintosh HD:Users:scottc:Documents:eBooks:"
	
	--capture the baby
	do shell script "screencapture -x " & quoted form of POSIX path of save_location �
		& "sc" & theDate & ".pdf"
	
end if

Scott,

I’m guessing that you have save as problems.

I’m not sure why OSAScript isn’t working. Do you know how to use mail in terminal to view the STDERR output of your chron job? Kel suggested using OPEN, and that’s how I do it too. To make this work, open your script and save it as an Application (File/Save As - select the application format). The resulting file will have a .app extension . Use “/usr/bin/open /Users/kel/Desktop/SayTime.app” as your cron call, and you should be good to go.

You’ll know you’ve got the thing saved correctly if you can double-click on your application and it just runs. Script editor will not open. To edit the script once it’s saved as an application, drag it on to script editor. When you save as an application, don’t check the “run only” check box. That will prevent your code from being saved in the application file.

I was checking off run only so that could have been an issue. But had been saving as an app and/or a compiled script and tried it both ways…

I have not tried this before. New to cron.

Upon doing this - I get this error: “sh: line1: screencapture: command not found.”

Thanks. Had run only checked - so good call. Definately had been saving as an app - and yes, when I double click it runs great.

Specify explicit paths for all applications called in your script.

Ok… first and foremost - Thank you, digest4d!

Secondly… that works fine… but my question is why? Why does the script work fine when called from Cronnix with the Run Now command:

do shell script "screencapture -x "...

but when actually saved to the cron tab, it needs:

do shell script "/usr/sbin/screencapture -x"...

Is it because Cronnix is being called from the OSX shell and the cron tab is being called from some remote part of the unix environment? (I think the answer to this will be helpful to other users down the road, as well.)

I’ll bet you’re explanation is exactly right. Type “env” in your bash shell in terminal and you’ll probably see that /usr/sbin/ is in your search path.