-
Notifications
You must be signed in to change notification settings - Fork 3
/
reset.sh
60 lines (43 loc) · 949 Bytes
/
reset.sh
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
57
58
59
60
#!/bin/bash
# minecraft server reset script
# read server files
source server.settings
source server.functions
# parse arguments
ParseArgs "$@"
ArgHelp
# safety checks
RootSafety
ScriptSafety
# debug
Debug "executing $0 script"
# change to server directory
ChangeServerDirectory
# check for existance of executable
CheckExecutable
# look if server is running
CheckScreen
# prints countdown to screen
Countdown "resetting"
# server stop
Stop
# awaits server stop
AwaitStop
# force quit server if not stopped
ForceQuit
# output confirmed stop
Log "ok" "server successfully stopped" "${screenLog}"
Print "ok" "server successfully stopped"
# create backup
CachedBackup "reset"
# remove log and world
Print "info" "removing world directory..."
nice -n 19 rm -r world
mkdir world
# restart the server
echo "action" "restarting server..."
./start.sh --force "$@"
# log to debug if true
Debug "executed $0 script"
# exit with code 0
exit 0