Lines 7-13
Link Here
|
7 |
# |
7 |
# |
8 |
# rc.conf variables: |
8 |
# rc.conf variables: |
9 |
# minecraft_enable (Default: NO) |
9 |
# minecraft_enable (Default: NO) |
10 |
# minecraft_mem (Default: 1024M) |
10 |
# minecraft_mem (Deprecated) (Default: $minecraft_memx) |
|
|
11 |
# minecraft_mems (Default: 1024M) |
12 |
# minecraft_memx (Default: 1024M) |
11 |
# minecraft_args (Default: "") |
13 |
# minecraft_args (Default: "") |
12 |
. /etc/rc.subr |
14 |
. /etc/rc.subr |
13 |
|
15 |
|
Lines 17-23
Link Here
|
17 |
|
19 |
|
18 |
load_rc_config $name |
20 |
load_rc_config $name |
19 |
|
21 |
|
20 |
minecraft_mem=${minecraft_mem:-"1024M"} |
22 |
minecraft_mems=${minecraft_mems:-"1024M"} |
|
|
23 |
minecraft_memx=${minecraft_memx:-"1024M"} |
24 |
minecraft_mem=${minecraft_mem} |
21 |
minecraft_args=${minecraft_args:-""} |
25 |
minecraft_args=${minecraft_args:-""} |
22 |
|
26 |
|
23 |
extra_commands="console status kill" |
27 |
extra_commands="console status kill" |
Lines 37-46
Link Here
|
37 |
{ |
41 |
{ |
38 |
if is_running; then |
42 |
if is_running; then |
39 |
echo "${name} is already running." |
43 |
echo "${name} is already running." |
|
|
44 |
elif [ ${minecraft_mems%?} -gt ${minecraft_memx%?} ]; then |
45 |
echo "ERROR: minecraft_mems is set greater than minecraft_memx." |
46 |
echo "ERROR: Set minecraft_memx to be equal or greater than minecraft_mems in rc.conf." |
40 |
else |
47 |
else |
|
|
48 |
if [ ! -z $minecraft_mem ]; then |
49 |
echo "WARNING: minecraft_mem is deprecated. Please change this to minecraft_memx." |
50 |
minecraft_memx=$minecraft_mem |
51 |
fi |
41 |
echo "Starting ${name}." |
52 |
echo "Starting ${name}." |
42 |
cd %%PREFIX%%/minecraft-server |
53 |
cd %%PREFIX%%/minecraft-server |
43 |
su mcserver -c "%%LOCALBASE%%/bin/tmux new-session -s minecraft -d '%%LOCALBASE%%/bin/java -Xmx${minecraft_mem} -Xms${minecraft_mem} ${minecraft_args} -jar %%PREFIX%%/minecraft-server/minecraft_server.%%VERSION%%.jar nogui'" |
54 |
su mcserver -c "%%LOCALBASE%%/bin/tmux new-session -s minecraft -d '%%LOCALBASE%%/bin/java -Xmx${minecraft_memx} -Xms${minecraft_mems} ${minecraft_args} -jar %%PREFIX%%/minecraft-server/minecraft_server.%%VERSION%%.jar nogui'" |
44 |
fi |
55 |
fi |
45 |
} |
56 |
} |
46 |
|
57 |
|