Maintenance Script to ensure other applications are running.

Posted on
Mon Dec 12, 2016 1:24 pm
whmoorejr offline
User avatar
Posts: 167
Joined: Jan 15, 2013
Location: Houston, TX

Maintenance Script to ensure other applications are running.

Forgive me if this is already posted somewhere.... but I couldn't find it.

I'm looking to put a scheduled maintenance script that will run periodically to ensure that certain indigo supporting applications are running.... and if not, turn them back on.

Once in a blue moon Growl or Airfoil will "Quit Unexpectantly". Looking for a small script to check if X is running. True = end. False = start application X.

What's the best approach? Applescript or a Python script? (I've never done anything with Python).

Posted on
Mon Dec 12, 2016 1:37 pm
marketability offline
User avatar
Posts: 156
Joined: Dec 08, 2015
Location: UK

Re: Maintenance Script to ensure other applications are runn

There's a plugin I use that should help do that...

http://forums.indigodomo.com/viewtopic.php?f=162&t=13678

Posted on
Mon Dec 12, 2016 1:45 pm
whmoorejr offline
User avatar
Posts: 167
Joined: Jan 15, 2013
Location: Houston, TX

Re: Maintenance Script to ensure other applications are runn

marketability wrote:
There's a plugin I use that should help do that...


Ooooh. I love getting new plugins. I just had a little indigogasm.

Posted on
Fri Dec 16, 2016 11:01 am
whmoorejr offline
User avatar
Posts: 167
Joined: Jan 15, 2013
Location: Houston, TX

Re: Maintenance Script to ensure other applications are runn

Out of the 4 applications I want to keep running (Airfoil, Growl, Plex, Remotsighlt) That plugin is only showing the status of Remotsight. I'm going to keep looking for a script that can do this and keep tweeking with that plugin to see if I can accomplish my goals that way.

Interestingly, I can start any of those four applications with the plugin, but it's not giving me a status on 3 of the 4.

Posted on
Sat Dec 17, 2016 1:37 am
marketability offline
User avatar
Posts: 156
Joined: Dec 08, 2015
Location: UK

Re: Maintenance Script to ensure other applications are runn

Yes just noticed that AirFoul status no longer reports - It did work - maybe the recent airfoil update broke it
having said that the new airfoil pro plugin included in 7 has a status connected / unavailable?

Posted on
Thu Dec 22, 2016 10:04 am
bkmar1192 offline
Posts: 261
Joined: Sep 12, 2015

Re: Maintenance Script to ensure other applications are runn

I am currently on a bus and am doing this from memory but can give you specifics later today if you want. I do this through An external AppleScript. If my memory serves my correctly The script does a try open on the application. On success/failure I update a variable in Indigo.


Sent from my iPhone using Tapatalk

Posted on
Fri Dec 23, 2016 8:56 am
bkmar1192 offline
Posts: 261
Joined: Sep 12, 2015

Re: Maintenance Script to ensure other applications are runn

Here is the Apple Script snippet. I run this script every 15 minutes, if one of the application running variables becomes false then a trigger runs to try and restart the app.

-Bert


Code: Select all
set thedate to (characters 1 thru 3 of (weekday of (current date) as string) & ", " & characters 1 thru 4 of (month of (current date) as string) & " " & (day of (current date) as string) & "  " & time string of (current date)) as string

if application "iTunes" is running then
   set value of variable "iTunesRunning" to "true"
   set value of variable "iTunesLastRunning" to thedate
else
   set value of variable "iTunesRunning" to "false"
end if

if application "Airfoil" is running then
   set value of variable "AirfoilRunning" to "true"
   set value of variable "AirfoilLastRunning" to thedate
else
   set value of variable "AirfoilRunning" to "false"
end if

if application "IndigoServer" is running then
   set value of variable "IndigoServerRunning" to "true"
   set value of variable "IndigoServerLastRunning" to thedate
else
   set value of variable "IndigoServerRunning" to "false"
end if

Posted on
Fri Dec 23, 2016 9:59 am
whmoorejr offline
User avatar
Posts: 167
Joined: Jan 15, 2013
Location: Houston, TX

Re: Maintenance Script to ensure other applications are runn

bkmar1192 wrote:

Code: Select all
if application "IndigoServer" is running then
   set value of variable "IndigoServerRunning" to "true"
   set value of variable "IndigoServerLastRunning" to thedate
else
   set value of variable "IndigoServerRunning" to "false"
end if


I'm stealing your script! A couple questions though. How well does the script work if the indigo server is down? With only an instance of indigo client running, I wouldn't think you could adjust a variable from an outside script or fire off a trigger to restart the indigo server. (Maybe some additional scripting to re-start the server, delay for a bit then adjust a variable so you know that the indigo server had to be restarted.?).

I was having Issues with external apple scripts adjusting indigo variables when I was trying to tie sightHound software to indigo. (Sometimes it would work, sometimes it would get an 'AppleScript 600 error' .... something along those lines. Have you noted any similar errors or tried quitting applications to test the scripts?

Posted on
Fri Dec 23, 2016 2:52 pm
bkmar1192 offline
Posts: 261
Joined: Sep 12, 2015

Re: Maintenance Script to ensure other applications are runn

For issue #1 - that is why I put a date stamp in a variable. If the date hasn't updated in a while but it still shows active I know something more serious is going on.

I used to have some stability issues so I would restart everything periodically. But I stopped doing that because my system has stabilized.

On #2 - there is process in the mac that if you stop the process it usually fixes the app not found issue. I run a script every hour that kills the process - has pretty much eliminated that issue.

But just in case, I have another external script that updates a variable to true. I then have a scheduled event that a) sets the variable to false b) runs the script. If the variable stays false for too long I know that external scripts aren't working.

I'll post sample code a little later.


Sent from my iPhone using Tapatalk

Posted on
Mon Jan 30, 2017 11:26 am
whmoorejr offline
User avatar
Posts: 167
Joined: Jan 15, 2013
Location: Houston, TX

Re: Maintenance Script to ensure other applications are runn

bkmar1192 wrote:
For issue #1 - ...


Thank You!

Sorry for the delay... Other indigo projects (and life) got in the way.

I've started running the script you posted every 15 minutes and works like a charm. Added a trigger for each "False" to re-start / activate a crashed app.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest