-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver_stop.bat
54 lines (40 loc) · 1.31 KB
/
server_stop.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
:#######################################################################
:# File name: server_stop.bat
:# Edited Last By: Mike Gleaves (ric)
:# V 1.0 20-9-2008
:# Comment: Run multi-Apache servers on same PC. Apache 2.2.9 core
:########################################################################
@echo off
rem ## Save return path
pushd %~dp0
rem ## Check to see if already stopped
if NOT exist udrive\usr\local\apache2\logs\httpd.pid goto :ALREADYKILLED
rem ## It exists is it running
SET /P pid=<udrive\usr\local\apache2\logs\httpd.pid
netstat -anop tcp | FIND /I " %pid%" >NUL
IF ERRORLEVEL 1 goto :NOTRUNNING
IF ERRORLEVEL 0 goto :RUNNING
:NOTRUNNING
rem ## Not shutdown using server_stop.bat hence delete file
del udrive\usr\local\apache2\logs\httpd.pid
goto :ALREADYKILLED
rem ## It is running hence shut server down
:RUNNING
rem ## Get drive letter
SET /P Disk=<udrive\usr\local\apache2\logs\drive.txt
rem ## Kill Apache process and all it's sub-processes
SET killstring= -t "%pid%"
udrive\home\admin\program\pskill.exe Apache_8.exe c
echo ::fZend Stopped
rem ## Remove pid file
del udrive\usr\local\apache2\logs\httpd.pid
rem ## Remove disk file
del udrive\usr\local\apache2\logs\drive.txt
rem ## Kill drive
subst %Disk%: /D
goto :END
:ALREADYKILLED
echo ::fZend already stopped
:END
rem ## Return to caller
popd