放羊的博客

万能的技术,苦逼的技术.

Minecraft Server Template

2015-01-29

Minecraft_server_template.txtMinecraft_server_template.txt
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
#!/bin/bash

# http://hydra-media.cursecdn.com/minecraft-zh.gamepedia.com/a/a9/Minecraft_server_template.txt

################################################################################
## MAKE SURE THIS SCRIPT IS AVAILABLE IN YOUR $PATH.
################################################################################
# It's highly advisable to create a directory to hold all of your server files. 
# The jar will generate quite a few files upon first run and it would get pretty 
# messy if there are other files in the same directory.
################################################################################
## NEEDED INFORMATION
################################################################################
# This is the location for a Debian/Ubuntu java executable
javaexec=/usr/bin/java

# Set this to the directory containing the minecraft_server.jar
# Provide the full path from /
server_location=CHANGE ME BEFORE DOING ANYTHING


################################################################################
## RUNNING THE SERVER
################################################################################
# By cd'ing to the server location
# All server files will be created in this directory.
cd $server_location

# Run the Server
`$javaexec -Xmx1024M -Xms1024M -jar $server_location/minecraft_server.jar nogui`

# After killing off the server, you will be cd'ed back to the directory you were 
# at prior to running this script.
cd -