-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmysql_stop.bat
56 lines (42 loc) · 1.17 KB
/
mysql_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
55
56
:########################################################################
:# File name: mysql_stop.bat
:# Created By: rAthena Development Team
:# Edited Last By: Yommy
:# V 1.0 17.12.2011
:########################################################################
@echo off
echo.
rem ## Save return path
pushd %~dp0
rem ## Check to see if already stopped
if NOT exist udrive\data\%COMPUTERNAME%.pid goto :ALREADYKILLED
rem ## It exists is it running
SET /P pid=<udrive\data\%COMPUTERNAME%.pid
netstat -anop tcp | FIND /I " %pid%" >NUL
IF ERRORLEVEL 1 goto :NOTRUNNING
IF ERRORLEVEL 0 goto :RUNNING
:NOTRUNNING
rem ## Not running clean-up
del udrive\data\%COMPUTERNAME%.pid
goto :ALREADYKILLED
rem ## It is running so shut server down
:RUNNING
rem ## Getdrive letter
SET /P Disk=<udrive\data\drive.txt
rem ## Remove pid file server was closed
del udrive\data\%COMPUTERNAME%.pid
rem ## Remove disk file
del udrive\data\drive.txt
rem ## Kill server
udrive\bin\mysqladmin.exe --port=3306 --user=ragnarok --password=ragnarok shutdown
rem ## Kill drive
subst %Disk%: /D
echo MySQL Stopped
goto :END
:ALREADYKILLED
echo MySQL already stopped
:END
echo.
pause
rem ## Return to caller
popd