put this into an "action group/ server/ execute script"
- Code: Select all
import os
#####
# script to stop and relauch indigo w a wait fo 30 seconds... usefull if you have an postgres resync issue.
# replace your userid home dir and indigo V# min 7.3
# OSX does not offer to print msecs in bash, set to 000 to keep indigo format
#####
indigoV = "7.3"
logFile = "/Library/Application Support/Perceptive Automation/Indigo "+ indigoV +"/Logs/indigo_log.txt"
home = "/users/karlwachs"
waitBfRelaunch = "30" # seconds
cmd = "#!/bin/bash\n"
cmd += "export HOME="+home+"\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==========================================' >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 stop and relaunch indogo after "+ waitBfRelaunch +" seconds ' >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== stop indigo app ' >> '"+logFile+"'\n"
cmd += "/usr/bin/osascript -e 'quit app \"Indigo "+indigoV+"\"' >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== sleep 1 ' >> '"+logFile+"'\n"
cmd += "/bin/sleep 1\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== stop indogo server' >> '"+logFile+"'\n"
cmd += "/usr/local/indigo/indigo-stop >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== sleep "+ waitBfRelaunch +"' >> '"+logFile+"'\n"
cmd += "/bin/sleep "+ waitBfRelaunch +"\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== start indigo server' >> '"+logFile+"'\n"
cmd += "/usr/local/indigo/indigo-start >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== sleep 3' >> '"+logFile+"'\n"
cmd += "/bin/sleep 3\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== start indigo app' >> '"+logFile+"'\n"
cmd += "/usr/bin/open '/Applications/Indigo "+indigoV+".app' >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 ==relaunch== done' >> '"+logFile+"'\n"
cmd += "date '+%Y-%m-%d %H:%M:%S.000 =========================================' >> '"+logFile+"'\n"
f=open("/tmp/restartIndigo.sh","w")
f.write(cmd)
f.close()
indigo.server.log("/tmp/restartIndigo.sh & --> \n"+cmd )
os.system("chmod +x /tmp/restartIndigo.sh")
os.system("/tmp/restartIndigo.sh &")
Karl