• 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: Stay-Open Script Apps vs Cron
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stay-Open Script Apps vs Cron


  • Subject: Re: Stay-Open Script Apps vs Cron
  • From: Gmail <email@hidden>
  • Date: Thu, 05 Jun 2014 08:05:03 -0400

I have a stay open script with an idle handler that runs every 15 minutes, perpetually.  It reads data from one running application and passes it to another.  The only time it would ever crash was when something had gone wrong with those other applications (not uncommon).  It was easily corrected with try/error loops that provide notification to me when some underlying process is misbehaving.  The script itself is perfectly reliable in my experience.

S. J. Cunningham
June 5, 2014 at 7:45 AM

Axel,

Thanks. I'll experiment with that as an option. I'm leaning toward cron rather than an idle loop because I have a vague suspicion that a "forever" idle loop is eventually going to misbehave. If I have to handle things synchronously anyway I suspect that cron will be more reliable. I'll probably experiment with both.

Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
Axel Luttgens
June 5, 2014 at 7:18 AM

Hello Steve,

Perhaps could you reverse the logics?

The easiest, and probably the safest, would be to have the idle handler run, say, every 5 minutes.

For example (with probably lots of details left as pseudo-code):

on idle

set last_activity to <fetch the last activity time from the last activity file as an AppleScript date>

if current date - last_activity >= 2*hours then
<sound a local alarm>
end if

return 5*minutes

end idle

HTH,
Axel


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
S. J. Cunningham
June 5, 2014 at 5:50 AM
On Jun 04, 2014, at 04:11, S. J. Cunningham <email@hidden> wrote:
I'm developing a "Dead Man" system to periodically check for inactivity and sound an alarm in the event.
______________________________________________________________________

Hey Steve,

What kind of inactivity?
I am the sole caregiver for my wife is totally paralyzed with MS and I am worried that if I became incapacitated she could die of dehydration before someone found us.  I am building a system to send out an escalating series of alarms if it hasn't detected me entering her room at least every two hours.  I have a Foscam set up at the doorway which sends an email every time it detects motion.  The email triggers a script which records the last activity time.  A second script "daemon" checks the last activity file every two hours and sounds a local alarm if there has been no activity.  If the alarm isn't retired within x minutes, it sends out text messages and emails to a prearranged list of responders.

I would prefer the daemon to run asynchronously, ie two hours from the last activity rather than simply every two hours.  I thought I could do this by changing the idle time in an idle handler every time an email arrives but it looks like that is not possible.

The Applescript option gives me more flexibility but I am leery of it's reliability.  If the app dies, so may the person I am monitoring :(
If I wanted to use AppleScript in a very stable fashion I'd think carefully about using Smile (free for non-commercial use).

>From the way you phrased it, I'm not sure if you are recommending it or recommending against it :)  I used to have Smile installed but it filled up the log with warnings from the system.  I forget the details but it's mere presence triggered the messages and the developer said he had no plans to fix it.  In any event I don't recall any functions it had which would increase stability.  I used it mostly for it's string matching functions and the standard applescript string functions work fine for this application.

Steve Cunningham
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
S. J. Cunningham
June 4, 2014 at 5:11 AM
I'm developing a "Dead Man" system to periodically check for inactivity and sound an alarm in the event. One option for the "daemon" is an AppleScript "stay-open" application which uses an idle handler to periodically check for inactivity. Another option is a script which is launched by cron (or the Apple Launch Agent system) which checks for inactivity and then quits.

The Applescript option gives me more flexibility but I am leery of it's reliability. If the app dies, so may the person I am monitoring :(

I would appreciate any experience other users/developers may have with a similar situation. I am running Snow Leopard.

P.S. I know there are other ways to do this but I am familiar with Applescript and don't have the time to teach myself Objective-C or some other language.

Thanks,

Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update http://lists.apple.com/archives/applescript-users

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:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Stay-Open Script Apps vs Cron (From: "S. J. Cunningham" <email@hidden>)
 >Re: Stay-Open Script Apps vs Cron (From: "S. J. Cunningham" <email@hidden>)
 >Re: Stay-Open Script Apps vs Cron (From: Axel Luttgens <email@hidden>)
 >Re: Stay-Open Script Apps vs Cron (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: Stay-Open Script Apps vs Cron
  • Next by Date: Re: Stay-Open Script Apps vs Cron
  • Previous by thread: Re: Stay-Open Script Apps vs Cron
  • Next by thread: Re: Stay-Open Script Apps vs Cron
  • Index(es):
    • Date
    • Thread