Batch Files to Restart Services on Windows
I wrote some batch files today for restarting services on windows. The bat files can be used to restart ColdFusion MX or IIS services on Windows NT/2000/XP.
Batch File to restart ColdFusion MX
@echo off REM - File: cfmxrestart.bat REM - Description: Restart's ColdFusion MX Services REM - Author: Pete Freitag echo Restarting ColdFusion MX... echo ====================================================== net stop "ColdFusion MX Application Server" net stop "ColdFusion MX ODBC Agent" net stop "ColdFusion MX ODBC Server" net start "ColdFusion MX Application Server" net start "ColdFusion MX ODBC Agent" net start "ColdFusion MX ODBC Server" echo ====================================================== echo ColdFusion MX Restarted
Batch file to restart IIS
@echo off REM - File: iisrestart.bat REM - Description: Restart's IIS (Web, FTP, SMTP) REM - Author: Pete Freitag REM - ADD REM comments if you don't want to restart any REM - of Services echo Restarting IIS... echo ====================================================== net stop "World Wide Web Publishing Service" net start "World Wide Web Publishing Service" net stop "FTP Publishing Service" net start "FTP Publishing Service" net stop "Simple Mail Transport Protocol (SMTP)" net start "Simple Mail Transport Protocol (SMTP)" echo ====================================================== echo IIS RestartedBat files are handy because you can restart multiple services with one command. You can either double click the bat file to run it, schedule it, or throw it in c:\windows\system32 and then run it from anywhere in the command prompt or (Start->Run)
Like this? Follow me ↯
Tweet Follow @pfreitagBatch Files to Restart Services on Windows was first published on October 09, 2002.
If you like reading about windows, services, bat, batch, iis, or coldfusion then you might also like:
- Tuning Tomcat IIS Connectors worker.properties and server.xml
- False TemplateNotFoundException ColdFusion 9
- ColdFusion Lockdown Series - Multiple Partitions
- Changing the ColdFusion CFIDE Scripts Location
- Is your ColdFusion Administrator Actually Public?
- ColdFusion 9 Performance Brief from Adobe
- Request Filtering in IIS 7 Howto
- IIS: Disabling Weak SSL Protocols and Ciphers
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.
Comments
Antoine -
You really just need to substitute in the service name from Services, for instance "ColdFusion 9 Application Server"
For CF8 I use this:
@echo off
echo Restarting ColdFusion 8...
echo ======================================================
net stop "ColdFusion 8 Application Server"
choice /T 20 /D y
net start "ColdFusion 8 Application Server"
echo ======================================================
echo ColdFusion 8 Restarted
You really just need to substitute in the service name from Services, for instance "ColdFusion 9 Application Server"
For CF8 I use this:
@echo off
echo Restarting ColdFusion 8...
echo ======================================================
net stop "ColdFusion 8 Application Server"
choice /T 20 /D y
net start "ColdFusion 8 Application Server"
echo ======================================================
echo ColdFusion 8 Restarted
by joe on 09/16/2011 at 2:34:52 PM UTC
i actually used cfexecute to run it
but if you have cf hanging you might want to have a php script execute it, or some other language