Author Topic: Recommendation: manually restart Applescripts after crash.  (Read 4019 times)

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6649
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Recommendation: manually restart Applescripts after crash.
« on: December 10, 2013, 08:16:29 PM »
Dear WeatherCat AppleScript fans,

As part of the "fun" of being a WeatherCat sekret agent, I've had a few early morning crashes of WeatherCat which were caught by the watchdog process so that WeatherCat restarted.  Unfortunately, the watchdog process doesn't know about my AppleScripts and vice versa. Since the AppleScripts are normally started after WeatherCat has settled down, they never run into a problem of requesting data from WeatherCat before WeatherCat can respond.

It seems that there is some weird voodoo going on when an AppleScript requests something from an application and that application doesn't respond.  In the past, WeatherCat has occasionally become hung if launched to respond to an AppleScript.  In this case, I had some even stranger happen: I got two shutdown growl notifications from WC Status Growler - when only one process of the script appeared to be running.

So it seems to me to be a prudent precaution.  If WeatherCat has crashed or become hung in any way, manually shutdown and restart the AppleScripts.  You can do this either by shutting down each script separately or running the Stop WeatherCat Scripts AppleScript.

These AppleScripts and the AppleScript system in general seems a little fragile, so as a general rule: caution is the better part of virtue!

Cheers, Edouard  [cheers1]

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Recommendation: manually restart Applescripts after crash.
« Reply #1 on: December 10, 2013, 08:24:35 PM »
Hi Edouard
 This one I haven't had any problems with but I do have it set to do the following in the the Advanced part of WeatherCat Preferences Startup/Shutdown Actions see attached:


cheers


 [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6649
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Forgot to train da' dawg! (Re: Manually restart Applescripts after crash.)
« Reply #2 on: December 11, 2013, 09:25:45 PM »
Howdy Randall,

This one I haven't had any problems with but I do have it set to do the following in the the Advanced part of WeatherCat Preferences Startup/Shutdown Actions see attached:

Yes, that is the way to get WeatherCat to launch and shutdown the AppleScripts if . . . .  everything goes normally.

My problem was caused by Stu's clever watchdog process that keeps an eye if WeatherCat crashes.  Being a selfish feline  [cat] (just kiddin' Stu), if WeatherCat crashes, it isn't polite enough to warn my AppleScripts in advance.

Now the obedient watch dog process steps in and restarts WeatherCat, but it doesn't know about my AppleScripts either.

It appears that all this commotion somehow messes with the karma of my AppleScrips from time to time resulting in - unexpected behavior!  :o

Honestly, my policy after a WeatherCat crash is to shutdown WeatherCat manually which should shutdown the AppleScripts if you have them set up as you do.  However, that is exactly what didn't happen in my case.  WC Status Growler got itself into some sort of a hang state.  I didn't have to force quit it, but when I quit it "manually" it appeared to be running twice.  I still don't have any idea how that could happen.

So in summary: caution is the better part of valor!

Cheers, Edouard  [cheers1]

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Recommendation: manually restart Applescripts after crash.
« Reply #3 on: December 11, 2013, 09:52:40 PM »
Hi Edouard
  Well maybe when WeatherCat relaunched using the WatchDog and if you have it set up to launch your scripts on restart maybe it launched WC growl again and that's why you had 2 of them running I think that happen to me before also


cheers


 [cheers1]

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6649
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
But, but, but . . . ya' can't! (Re: Restart Applescripts after crash.)
« Reply #4 on: December 12, 2013, 09:14:36 PM »
Dear Randall and WeatherCat Scripters,

Well maybe when WeatherCat relaunched using the WatchDog and if you have it set up to launch your scripts on restart maybe it launched WC growl again

But, but, but . . . . . ya' can't!

If a Mac application is already running, the Finder is supposed to just bring it to the foreground.  Mac's have been that way since at least 1988 when I got my first Mac II.

Now you may be correct that somehow a second process of WC Status Growler was launched - but I have no idea how that could happen!

Oh well,

Cheers, Edouard

Randall75

  • Storm
  • *****
  • Posts: 1332
  • CWOP-CW6734 WeatherUnderground-KOHNEWAR6
    • CW6734
    • KOHNEWAR6
    • Randy's Weather On The Hill
  • Station Details: Davis Vantage Pro 2 Plus.iMac i5 OS High Sierra 10.13.6 8GB Ram, WeatherCat 3,Logitech 9000 Pro Web Cam
Re: Recommendation: manually restart Applescripts after crash.
« Reply #5 on: December 12, 2013, 10:04:05 PM »
Edouard
 Gremlins  [biggrin]
it did some how [goofy]
had two of them running at the same  [banghead]




cheers


 [cheers1]