Indigo-PhoneValet Integration
| Author |
Message |
|
BillC
Joined: Mar 09, 2008 Posts: 183
|
I have the same problem (snow leopard 10.6.1, Indigo 4.1.1, Phone Valet 6.0.3) with the variables occasionally not being updated. It's happening now, by chance, so I entered the ps command with the following results:
MacMini:~ homeauto$ ps -axwww | grep Indigo 137 ?? 50:47.29 /Library/Application Support/Perceptive Automation/Indigo 4/IndigoServer.app/Contents/MacOS/IndigoServer 180 ?? 47:20.48 /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoWebServer/IndigoWebServer.py -i1176 -w8176 -cfn 41395 ?? 24:10.51 /Applications/Indigo 4.app/Contents/MacOS/Indigo 4 -psn_0_19341937 58144 ttys000 0:00.00 grep Indigo MacMini:~ homeauto$
No background scripts...It's not just Phone Valet...restarted IndigoServer and now get: MacMini:~ homeauto$ ps -axwww | grep Indigo 41395 ?? 24:12.25 /Applications/Indigo 4.app/Contents/MacOS/Indigo 4 -psn_0_19341937 58152 ?? 0:00.64 /Library/Application Support/Perceptive Automation/Indigo 4/IndigoServer.app/Contents/MacOS/IndigoServer 58153 ?? 0:01.07 /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoWebServer/IndigoWebServer.py -i1176 -w8176 -cfn 58156 ?? 0:00.25 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/iTunes sync.scpt 58157 ?? 0:00.29 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/Weather NOAA sync.scpt 58158 ?? 0:00.19 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/PhoneValet Background Script.scpt 58165 ttys000 0:00.00 grep Indigo MacMini:~ homeauto$
|
| Fri Nov 06, 2009 7:28 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
BillC wrote:I have the same problem (snow leopard 10.6.1, Indigo 4.1.1, Phone Valet 6.0.3) with the variables occasionally not being updated. It's happening now, by chance, so I entered the ps command with the following results: MacMini:~ homeauto$ ps -axwww | grep Indigo 137 ?? 50:47.29 /Library/Application Support/Perceptive Automation/Indigo 4/IndigoServer.app/Contents/MacOS/IndigoServer 180 ?? 47:20.48 /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoWebServer/IndigoWebServer.py -i1176 -w8176 -cfn 41395 ?? 24:10.51 /Applications/Indigo 4.app/Contents/MacOS/Indigo 4 -psn_0_19341937 58144 ttys000 0:00.00 grep Indigo MacMini:~ homeauto$
No background scripts...It's not just Phone Valet...restarted IndigoServer and now get: MacMini:~ homeauto$ ps -axwww | grep Indigo 41395 ?? 24:12.25 /Applications/Indigo 4.app/Contents/MacOS/Indigo 4 -psn_0_19341937 58152 ?? 0:00.64 /Library/Application Support/Perceptive Automation/Indigo 4/IndigoServer.app/Contents/MacOS/IndigoServer 58153 ?? 0:01.07 /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoWebServer/IndigoWebServer.py -i1176 -w8176 -cfn 58156 ?? 0:00.25 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/iTunes sync.scpt 58157 ?? 0:00.29 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/Weather NOAA sync.scpt 58158 ?? 0:00.19 /usr/bin/osascript /Library/Application Support/Perceptive Automation/Indigo 4/Scripts/Background Tasks/PhoneValet Background Script.scpt 58165 ttys000 0:00.00 grep Indigo MacMini:~ homeauto$
Yep, that's what I was afraid of. It kills some or all of my background scripts too, not just the PhoneValet script. I've been trying to track down anything that might be causing it and so far nothing. I have a time/date action that runs every minute and checks to see if the background tasks are running or not and it logs when they disappear so I can try to correlate with Console log entries, etc. So far nothing. I'll keep this thread posted on anything I can find.
_________________ Jay (Indigo Support)
|
| Fri Nov 06, 2009 8:43 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
jay wrote:Yep, that's what I was afraid of. It kills some or all of my background scripts too, not just the PhoneValet script. I've been trying to track down anything that might be causing it and so far nothing. I have a time/date action that runs every minute and checks to see if the background tasks are running or not and it logs when they disappear so I can try to correlate with Console log entries, etc. So far nothing. I'll keep this thread posted on anything I can find.
Has anyone else noticed that any of their stay-open background AppleScripts (iTunes Sync, NOAA Weather, etc) have just spontaneously stopped with no errors? I'd like to get a feel for how wide-spread the problem is. Thanks.
_________________ Jay (Indigo Support)
|
| Fri Nov 06, 2009 8:56 pm |
|
 |
|
JeffS
Joined: Jul 14, 2008 Posts: 30
|
Jay-
The results of the grep were:
518 ?? 3:27.61 /Library/Application Support/Perceptive Automation/Indigo 4/IndigoServer.app/Contents/MacOS/IndigoServer
529 ?? 8:55.98 /Applications/Indigo 4.app/Contents/MacOS/Indigo 4 -psn_0_307275
537 ?? 3:46.92 python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoWebServer/IndigoWebServer.py -i1176 -w8176 -cfn
538 ?? 2:00.90 python /Library/Application Support/Perceptive Automation/Indigo 4/IndigoSqlClient/IndigoSqlClient.py -i1176
29877 ttys000 0:00.00 grep Indigo
So I assume that it died...
Any suggestions?
Thanks for your quick attention and support!
Jeff
|
| Fri Nov 06, 2009 9:19 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
This is a work-around that might resolve the problem you are seeing with background scripts. Try launching the script from inside a simple watchdog shell shell, something like:
- Code: Select all
#!/bin/sh
while [#!/bin/sh
while [ true ] do /usr/bin/osascript ./test.scpt >> scripterr.log 2>&1 DATE=`date` echo "test.scpt died at $DATE" >> scripterr.log done
exit 0
To start the process, you'd just enter runscript.sh >> scripterr.log 2>&1 &
You could probably start all of your watchdog shells from an Indigo Startup trigger. Likewise, with a little tweaking, you could probably get the output from the shell into the Indigo log. See this web page.
|
| Fri Nov 06, 2009 10:14 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
I decided to try the logging to Indigo. It works. So, if you start your background AppleScript from an embedded Indigo AppleScript like - Code: Select all
do shell script "/Users/foo/bin/testscpt-watcher.sh &"
where testscpt-watcher.sh looks something like this: - Code: Select all
#!/bin/sh while [ true ] do /usr/bin/osascript ./test.scpt EXCODE=$? DATE=`date` /usr/bin/osascript ./indigoLogger.scpt test.scpt $EXCODE done exit 0
and this AppleScript (saved as indigoLogger.scpt) - Code: Select all
on run argv tell application "IndigoServer" log "Script " & item 1 of argv & " died with exit code " & item 2 of argv & " and was restarted" using type "Background Script" end tell end run
you get Indigo log messages like - Code: Select all
Nov 6, 2009 8:38:45 PM Background Script Script test.scpt died with exit code 143 and was restarted
anytime the background script dies and needs to be restarted.
You could generalize this script to pass the background script name on the command line and then call it like:do shell script "/Users/foo/bin/watchdog.sh test.scpt" That way you'd only need one shell script to start and monitor any background task.
If there is sufficient interest, I can clean all this up and post it to the user contributions library with some basic documentation.
|
| Fri Nov 06, 2009 10:53 pm |
|
 |
|
BillC
Joined: Mar 09, 2008 Posts: 183
|
@berkinet, I'm going to be busy this weekend but when I get a few minutes free I'll see if I can get your script running...thanks!
Jay, you might post that question (other users w/ problem) as its own topic in the applescript section, don't know how much traffic this thread gets and the problem is not limited to PV.
NOTE: I made an error in my post above, my homeauto computer is NOT running Snow Leopard, it's on 10.5.8 (it's the only one I haven't upgraded yet). Other program versions are correct.
|
| Sat Nov 07, 2009 5:06 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
BillC wrote:NOTE: I made an error in my post above, my homeauto computer is NOT running Snow Leopard, it's on 10.5.8 (it's the only one I haven't upgraded yet). Other program versions are correct.
Good information, thanks, now I have 2 cases where it's happening on Leopard.
_________________ Jay (Indigo Support)
|
| Sat Nov 07, 2009 8:25 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6659 Location: Austin, Texas
|
berkinet wrote:I decided to try the logging to Indigo. It works. So, if you start your background AppleScript from an embedded Indigo AppleScript like - Code: Select all
do shell script "/Users/foo/bin/testscpt-watcher.sh &"
where testscpt-watcher.sh looks something like this: - Code: Select all
#!/bin/sh while [ true ] do /usr/bin/osascript ./test.scpt EXCODE=$? DATE=`date` /usr/bin/osascript ./indigoLogger.scpt test.scpt $EXCODE done exit 0
and this AppleScript (saved as indigoLogger.scpt) - Code: Select all
on run argv tell application "IndigoServer" log "Script " & item 1 of argv & " died with exit code " & item 2 of argv & " and was restarted" using type "Background Script" end tell end run
you get Indigo log messages like - Code: Select all
Nov 6, 2009 8:38:45 PM Background Script Script test.scpt died with exit code 143 and was restarted
anytime the background script dies and needs to be restarted. You could generalize this script to pass the background script name on the command line and then call it like:do shell script "/Users/foo/bin/watchdog.sh test.scpt" That way you'd only need one shell script to start and monitor any background task. If there is sufficient interest, I can clean all this up and post it to the user contributions library with some basic documentation.
Great idea Richard, my logger is only logging when it dies - maybe the exit code will tell us something more.
_________________ Jay (Indigo Support)
|
| Sat Nov 07, 2009 8:26 am |
|
 |
|
BillC
Joined: Mar 09, 2008 Posts: 183
|
I'm trying to run berkinet's scripts and the PV background script isn't starting.
I'm using - Code: Select all
do shell script "/Library/Application Support/Perceptive Automation/Test/testscpt-watcher.sh &"
in a startup trigger action. My testscpt-watcher.sh: - Code: Select all
#!/bin/sh while [ true ] do /usr/bin/osascript "/Library/Application Support/Perceptive Automation/Test/PhoneValet Background Script.scpt" EXCODE=$? DATE='date' /usr/bin/osascript "/Library/Application Support/Perceptive Automation/Test/indigoLogger.scpt PhoneValet Background Script.scpt $EXCODE" done exit 0
My indigoLogger.scpt: - Code: Select all
on run argv tell application "IndigoServer" log "Script " & item 1 of argv & " died with exit code " & item 2 of argv & " and was restarted" using type "Background Script" end tell end run
No errors in Indigo or console logs, but the PV script never starts (at least doesn't show up in ps immediately after starting the server). Edit to add: Contents of /Library/Application Support/Perceptive Automation/Test/ - Code: Select all
MacMini:Test homeauto$ ls -al total 80 drwxr-xr-x 5 xxxxxx admin 170 Nov 8 11:02 . drwxrwxr-x 5 root admin 170 Nov 8 10:51 .. -rw-rw-rw-@ 1 xxxxxx admin 18272 Oct 17 12:07 PhoneValet Background Script.scpt -rw-rw-rw-@ 1 xxxxxx staff 1552 Nov 8 11:02 indigoLogger.scpt -rwxrwxrwx@ 1 xxxxxx admin 313 Nov 8 11:59 testscpt-watcher.sh MacMini:Test homeauto$
|
| Sun Nov 08, 2009 11:13 am |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
is testscpt-watcher.sh executable? (chmod 755 testscpt-watcher.sh)
|
| Sun Nov 08, 2009 12:56 pm |
|
 |
|
BillC
Joined: Mar 09, 2008 Posts: 183
|
berkinet wrote:is testscpt-watcher.sh executable? (chmod 755 testscpt-watcher.sh)
I think so... -rwxrwxrwx@ 1 xxxxxx admin 313 Nov 8 11:59 testscpt-watcher.sh
|
| Sun Nov 08, 2009 2:01 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
Hmmm. What do you get if you just run testscpt-watcher.sh from a terminal window. Try something like:
./testscpt-watcher.sh >> log.txt 2>&1 &
Then run the ps command to see if your script started. If it works from the terminal window, then you might try your embedded AS command in AppleScript Editor inside of a tell block and watch the Events/replies.
EDIT: If it doesn't work from the command line, see what log.txt has recorded.
|
| Sun Nov 08, 2009 2:09 pm |
|
 |
|
BillC
Joined: Mar 09, 2008 Posts: 183
|
Hmmm. What do you get if you just run testscpt-watcher.sh from a terminal window. Try something like: ./testscpt-watcher.sh >> log.txt 2>&1 &
That started the script. log.txt is empty. try your embedded AS command in AppleScript Editor inside of a tell block and watch the Events/replies.
Like this?
- Code: Select all
tell application "Finder" do shell script "/Library/Application Support/Perceptive Automation/Test/testscpt-watcher.sh &" end tell
Result is a null string (two double quotation marks with nothing between).
Thanks for the help...I'm barely literate in AS and probably not even that in shell scripts.
|
| Sun Nov 08, 2009 2:25 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
BillC wrote:...Thanks for the help...I'm barely literate in AS and probably not even that in shell scripts.
Don't sell yourself short. You seem to be doing fine.
I was thinking you would use:
tell application "IndigoServer"
But, in fact, just get rid of the tell and end tell lines and try it with just the do shell script command.
|
| Sun Nov 08, 2009 2:33 pm |
|
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|