Overclockers Australia Forums

OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Programming & Software Development

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 11th July 2012, 8:51 AM   #1
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default script to restart process if not responding

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
mp2031 is offline   Reply With Quote

Join OCAU to remove this ad!
Old 11th July 2012, 2:13 PM   #2
flores741
Member
 
flores741's Avatar
 
Join Date: Jul 2003
Posts: 773
Default

You could just about use any language to do this. Why not give AutoIT a try? (http://www.autoitscript.com/site/autoit/)
__________________

Me
flores741 is offline   Reply With Quote
Old 11th July 2012, 5:01 PM   #3
f3n1x
Member
 
f3n1x's Avatar
 
Join Date: Mar 2003
Location: Armadale, Melbourne
Posts: 1,653
Default

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#.
__________________
f3n.org|systems admin, graphics & foss software

Canon Eos 40D. Canon 50mm f1.8. Tamron SP AF28-75mm F/2.8 XR Di LD Aspherical (IF). Sigma EF 500 DG Super ETTL Flash(Broken! :/)
f3n1x is offline   Reply With Quote
Old 11th July 2012, 5:49 PM   #4
zach
Member
 
zach's Avatar
 
Join Date: May 2009
Location: chermside.bris.qld.au:80
Posts: 2,578
Default

http://msdn.microsoft.com/en-us/libr...esponding.aspx

Such a hassle ha ha.
zach is online now   Reply With Quote
Old 12th July 2012, 9:49 AM   #5
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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
mp2031 is offline   Reply With Quote
Old 12th July 2012, 10:01 AM   #6
bugayev
Whammy!
 
bugayev's Avatar
 
Join Date: May 2003
Location: Melbourne
Posts: 3,945
Default

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
bugayev is offline   Reply With Quote
Old 12th July 2012, 10:13 AM   #7
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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
mp2031 is offline   Reply With Quote
Old 12th July 2012, 2:39 PM   #8
f3n1x
Member
 
f3n1x's Avatar
 
Join Date: Mar 2003
Location: Armadale, Melbourne
Posts: 1,653
Default

Quote:
Originally Posted by mp2031 View Post
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

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.
__________________
f3n.org|systems admin, graphics & foss software

Canon Eos 40D. Canon 50mm f1.8. Tamron SP AF28-75mm F/2.8 XR Di LD Aspherical (IF). Sigma EF 500 DG Super ETTL Flash(Broken! :/)
f3n1x is offline   Reply With Quote
Old 12th July 2012, 2:43 PM   #9
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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?
mp2031 is offline   Reply With Quote
Old 12th July 2012, 2:46 PM   #10
power
Member
 
power's Avatar
 
Join Date: Apr 2002
Location: brisbane
Posts: 27,206
Default

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.
power is offline   Reply With Quote
Old 13th July 2012, 9:15 AM   #11
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

Service is now opening but won't connect to my network drives while running as service.
mp2031 is offline   Reply With Quote
Old 13th July 2012, 9:23 AM   #12
bugayev
Whammy!
 
bugayev's Avatar
 
Join Date: May 2003
Location: Melbourne
Posts: 3,945
Default

Quote:
Originally Posted by mp2031 View Post
Service is now opening but won't connect to my network drives while running as service.
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
bugayev is offline   Reply With Quote
Old 13th July 2012, 9:59 AM   #13
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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
mp2031 is offline   Reply With Quote
Old 13th July 2012, 10:51 AM   #14
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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
mp2031 is offline   Reply With Quote
Old 18th July 2012, 8:01 AM   #15
mp2031 Thread Starter
Member
 
Join Date: Aug 2008
Location: Randwick , Sydney
Posts: 25
Default

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
mp2031 is offline   Reply With Quote
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 5:37 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!