#52964 - 2001-01-03 01:33 AM
Has anyone done this before: Script to check IIS status, if down, restart service ...
|
Anonymous
Anonymous
Unregistered
|
. . .or re-boot the box ??I just got handed a request: develop a script that will check IIS status every so often, and if it isn't responding, stop and start the IIS service, or, alternately, re-start the box. I was planning on using AT to run the script, but has anyone done anything REMOTELY like this in Kixtart ???
|
|
Top
|
|
|
|
#52965 - 2001-01-03 04:51 AM
Re: Has anyone done this before: Script to check IIS status, if down, restart service ...
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
I have done this with a batch File.. You could shell out and do it with KIX..Here are the BATCH Commands.. code:
::STOP THE FTP SERVICE NET STOP "FTP Publishing Service" ::STOP THE WWW PUBLISHING SERVICE NET STOP W3SVC ::STOP IISADMIN ECHO Y | NET STOP IISADMIN ::WAIT 30 SECONDS FOR THE SERVICE TO COMPLETELY STOP SLEEP 30 : :DELETE TEMP/JUNK FILES IN THE TEMP LOCATION DEL /S/Q %TEMP%\*.TMP DEL /S/Q %TEMP%\~*.* DEL /S/Q %TEMP%\ff*.TMP : :DELETE TEMP/JUNK FILES FROM WINNT DEL /S/Q %WINDIR%\*.TMP DEL /S/Q %WINDIR%\~*.TMP DEL /S/Q %WINDIR%\ff*.TMP : :DELETE FDF FILES FROM WORKORDER LOCATION DEL /S/Q "E:\PDF Personalization\Workorder\*.FDF" ::RESTART THE WEB SERVICE NET START IISADMIN ::START THE FTP SERVICE NET START "FTP Publishing Service" ::INSURE W3SVC IS STARTED NET START|FIND /I "WORLD WIDE WEB PUBLISHING SERVICE" IF ERRORLEVEL 1 GOTO :W3SVC IF ERRORLEVEL 0 GOTO :EOF:W3SVC NET START W3SVC GOTO :EOF :EOF EXIT ::IF EXIT DOES NOT WORK, THIS DOES ;-) CLS
I know this is not KIX, but this should get you going.. You can also use the shutdown from the NT Resource Kit. Cheers, Kent
[This message has been edited by kdyer (edited 03 January 2001).]
|
|
Top
|
|
|
|
#52967 - 2001-01-05 07:15 PM
Re: Has anyone done this before: Script to check IIS status, if down, restart service ...
|
Anonymous
Anonymous
Unregistered
|
Try using NETSVC from the NT Resource kit with the /query switch to check the status of a server.Good luck. Roneil
|
|
Top
|
|
|
|
#52968 - 2001-01-11 04:09 PM
Re: Has anyone done this before: Script to check IIS status, if down, restart service ...
|
Anonymous
Anonymous
Unregistered
|
I think it's simpler to use the Unix-like command GREP (also from the Resource Kit) to check shell output results. This will avoid creating and reading temporary files ....I use a script like this one: $SERVICE_NAME="W3SVC" SHELL "%COMSPEC% /C SC.EXE QUERY " + $SERVICE_NAME + " |GREP RUNNING" IF @ERROR=0 ? "It's running" ELSE ? "It's NOT running" ENDIF
|
|
Top
|
|
|
|
#52970 - 2001-01-11 05:45 PM
Re: Has anyone done this before: Script to check IIS status, if down, restart service ...
|
Anonymous
Anonymous
Unregistered
|
Geeze. . . I can GREP in NT now ??? Excellent. There's a CRON for NT out there as well, beats the pants off of AT. . . .
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|