Last active
August 29, 2015 14:17
-
-
Save vensko/86d0d13cbf32e89d9133 to your computer and use it in GitHub Desktop.
stop_server.bat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem http://blog.vensko.net/webdev/web-server-batch-script | |
@echo off | |
tasklist /FI "IMAGENAME eq php.exe" 2>NUL | find /I /N "php.exe" >nul | |
if "%ERRORLEVEL%"=="0" ( | |
echo Stopping PHP server... | |
taskkill /F /FI "IMAGENAME eq php.exe" 2>&1 >nul | |
) | |
tasklist /FI "IMAGENAME eq memcached.exe" 2>NUL | find /I /N "memcached.exe" >nul | |
if "%ERRORLEVEL%"=="0" ( | |
echo Stopping Memcached... | |
taskkill /F /FI "IMAGENAME eq memcached.exe" 2>&1 >nul | |
) | |
tasklist /FI "IMAGENAME eq mongod.exe" 2>NUL | find /I /N "mongod.exe" >nul | |
if "%ERRORLEVEL%"=="0" ( | |
echo Stopping MongoDB... | |
mongo --eval "db.getSiblingDB('admin').shutdownServer()" | |
) | |
tasklist /FI "IMAGENAME eq redis-server.exe" 2>NUL | find /I /N "redis-server.exe" >nul | |
if "%ERRORLEVEL%"=="0" ( | |
echo Stopping Redis... | |
taskkill /F /FI "IMAGENAME eq redis-server.exe" 2>&1 >nul | |
) | |
tasklist /FI "IMAGENAME eq mysqld.exe" 2>NUL | find /I /N "mysqld.exe" >nul | |
if "%ERRORLEVEL%"=="0" ( | |
echo Stopping MariaDB... | |
mysqladmin shutdown -u root 2>&1 >nul | |
nircmd waitprocess mysqld.exe | |
) | |
if exist W: subst W: /D | |
echo Server stopped. | |
timeout /T 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment