![]() |
![]() OCAU News - Wiki - QuickLinks - Pix - Sponsors |
|
|||||||
| Notices |
|
Sign up for a free OCAU account and this ad will go away! Search our forums with Google: |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
Hey guys,
As title says I am trying to write a short script to check if a process is responding and if it isn't, restart the process. (windows 7 64bit pro) thanks in advance Miles |
|
|
|
| Join OCAU to remove this ad! |
|
|
#2 |
|
Member
Join Date: Jul 2003
Posts: 773
|
You could just about use any language to do this. Why not give AutoIT a try? (http://www.autoitscript.com/site/autoit/)
|
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2003
Location: Armadale, Melbourne
Posts: 1,653
|
Not responding on what interface? (ie http, telnet or a windows forms ui?)
If its http or telnet this script or a customisation thereof should do: http://stackoverflow.com/questions/6...for-windows-os If its a GUI, i'd suggest trying try autoit and if that doesn't work whip something up in c#. |
|
|
|
|
|
#4 |
|
Member
Join Date: May 2009
Location: chermside.bris.qld.au:80
Posts: 2,578
|
|
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
Hey guys,
Thanks for your help, I am currently using the following script but it doesn't seem to do anything. Any ideas? @ECHO OFF ECHO Restart Application DEADLINE SLAVE ECHO ECHO Heckler ECHO. ECHO. SETLOCAL EnableExtensions REM Enter the application information. SET AppName=deadlineslave SET ExeFile=deadlineslave.exe SET ExePath=C:\Program Files\Thinkbox\Deadline\bin REM Select the conditions to kill the application. REM A value of 1 = Yes, 0 = No SET KillIfRunning=0 SET KillIfNotResponding=1 SET KillIfUnknownStatus=1 REM Specify when to start the application: REM 1 = Start only if the process was previous killed. REM 0 = Start the application regardless. SET StartOnlyIfKilled=1 SET KillStatus="%TEMP%KillStatus.tmp.txt" SET Success=0 ECHO Killing existing %AppName% instance... IF {%KillIfRunning%}=={1} CALL :CheckKillStatus "%ExeFile%" "RUNNING" IF {%KillIfNotResponding%}=={1} CALL :CheckKillStatus "%ExeFile%" "NOT RESPONDING" IF {%KillIfUnknownStatus%}=={1} CALL :CheckKillStatus "%ExeFile%" "UNKNOWN" ECHO. IF {%StartOnlyIfKilled%}=={1} ( IF {%Success%}=={0} GOTO End ) ECHO Restarting %AppName%... START "%ExeFile%" "%ExePath%%ExeFile%" ECHO. IF EXIST %KillStatus% DEL /F /Q %KillStatus% ENDLOCAL :CheckKillStatus ECHO Killing with status: %~2 TASKKILL /FI "STATUS eq %~2" /IM "%~1" /F > %KillStatus% SET /P KillResult= < %KillStatus% FOR /F "tokens=1,* delims=:" %%A IN ("%KillResult%") DO ( ECHO %%A:%%B IF /I {%%A}=={SUCCESS} SET /A Success=%Success%+1 ) :End |
|
|
|
|
|
#6 |
|
Whammy!
Join Date: May 2003
Location: Melbourne
Posts: 3,945
|
Your better bet might be to run the slave in service mode, and simply set that to auto restart.
__________________
Administrator: Apple Desktop Hardware/Software, Graphics and Programming, Digital Art, iOS Devices, For Sale (PC and Non-PC), Price Check and What/Where Should I Buy? mercury: 11" Macbook Air, i5, 4Gb RAM, 128Gb SSD lunchbox: Mac mini, i5 Dual Core, 4Gb RAM, 500Gb HDD |
|
|
|
|
|
#7 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
bugayev you life saver!
This is a good fix but if possible I would like a script as I have to reinstall as a service on about 30machines otherwise ![]() Miles |
|
|
|
|
|
#8 | |
|
Member
Join Date: Mar 2003
Location: Armadale, Melbourne
Posts: 1,653
|
Quote:
30 machines? Really not that hard to reinstall one piece of software on 30 machines, I could understand looking for a better way if it was 300. |
|
|
|
|
|
|
#9 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
Ok I have attempted re-installing deadline as a service and it just hangs in services saying deadlinelauncher.exe starting... wont go off that though. Any ideas?
|
|
|
|
|
|
#10 |
|
Member
Join Date: Apr 2002
Location: brisbane
Posts: 27,206
|
I use this, it will restart services for you - but it won't just keep trying forever and will then alert you so you can look at the issue more closely.
http://www.ks-soft.net/hostmon.eng/ might not be appropriate for 30 machines, it sounds like you have a bigger problem.
__________________
this is who we are. |
|
|
|
|
|
#11 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
Service is now opening but won't connect to my network drives while running as service.
|
|
|
|
|
|
#12 |
|
Whammy!
Join Date: May 2003
Location: Melbourne
Posts: 3,945
|
You'll have to check the documentation and figure out how to get it to do this. It could be account-related as the service will be running with different permissions.
__________________
Administrator: Apple Desktop Hardware/Software, Graphics and Programming, Digital Art, iOS Devices, For Sale (PC and Non-PC), Price Check and What/Where Should I Buy? mercury: 11" Macbook Air, i5, 4Gb RAM, 128Gb SSD lunchbox: Mac mini, i5 Dual Core, 4Gb RAM, 500Gb HDD |
|
|
|
|
|
#13 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
service has network access but wont let me login to nas under different domain eg
Username : domain\user Password : user Only local eg Username : user Password : user Is there a way around this? otherwise I may need a script |
|
|
|
|
|
#14 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
for those interested I have found a program that will monitor a process and restart if need be
http://www.knas.se/Applications/Restarter.aspx |
|
|
|
|
|
#15 |
|
Member
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
|
ok it seems that the application will only restart the process if ended.. & runnning deadline as a service you must be on a domain both of these options are no good
![]() could anyone tell me what is wrong with my script? thanks in advance! miles |
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|