forked from Codeprogrammers/codecraft-init-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminecraft
executable file
·580 lines (472 loc) · 19.6 KB
/
minecraft
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
#!/bin/bash
# /etc/init.d/minecraft
# version 0.4.1 2012-01-06 (YYYY-MM-DD)
### BEGIN INIT INFO
# Provides: minecraft
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minecraft server
# Description: Starts the minecraft server
### END INIT INFO
# chkconfig 2345 99 01
# Codecraft-init-script: Linux init script for starting minecraft as a service
# Copyright (C) 2011-2012 Daniel Hodgson, William Haggerty, Codeprogrammers
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#Settings
USERNAME="daniel"
GROUPNAME="daniel"
SCREEN_NAME="codecraft"
BUILD="b1597"
SERVICE="craftbukkit.jar"
INVOCATION="java -Xms512M -Xmx1024M -jar craftbukkit.jar"
RAMDISK="true"
RD_SIZE="128m"
#File Paths/Names
ROOT_PATH="/mnt/codecraft"
WORLD_DIR="worlds"
SERVER_DIR="servers"
RD_DIR="ramdisk"
ROOT_BUPATH="$ROOT_PATH/archives"
#Messages (sent to minecraft server console with "say" command)
SAVE_OFF_MSG="Server going readonly..."
SAVE_ON_MSG="Server going read-write..."
BACKUP_START_MSG="SERVER BACKUP STARTING"
BACKUP_RD_START_MSG="RAMDISK BACKUP STARTING"
BACKUP_DONE_MSG="SERVER BACKUP COMPLETE"
BACKUP_FAIL_MSG="SERVER BACKUP FAILED"
STOP_MSG="SERVER SHUTTING DOWN IN 15 SECONDS"
RESTART_MSG="SERVER GOING FOR RESTART"
############################[ Script Start]#############################
lockfile="/var/lock/minecraft"
#Grabbing world name from $MC_PATH/server.properties
WORLD_NAME=$(cat $ROOT_PATH/$SERVER_DIR/$BUILD/server.properties | fgrep 'level-name=' | sed -e s/.*level-name=//)
#Run commands as the user defined in the $USERNAME variable
ME=`whoami`
as_user() {
if [ $ME == $USERNAME ]
then
bash -c "$1"
else
su - $USERNAME -c "$1"
fi
}
#--------------------+
# Starts the service |
#--------------------+
# If the service is already running, will alert the user and end the function.
# If ramdisk feature is enabled, will attempt to mount and load the ramdisk.
# If the service fails to start, and ramdisk feature is enabled, will attempt
#+ to unload the ramdisk and unmount it.
#--------------------+
mc_start() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "Tried to start but $SERVICE was already running!"
else echo "Starting $SERVICE"
if [ $RAMDISK == 'true' ]
then
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then echo "Ramdisk Loaded"
mcrd_load
else echo "Loading Ramdisk"
mcrd_mount
mcrd_load
fi
fi
as_user "cd $ROOT_PATH/$SERVER_DIR/$BUILD && screen -dmS $SCREEN_NAME $INVOCATION" ; sleep 7
#Check to see if the service started successfully
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE is now running."
else echo "Could not start $SERVICE."
if [ $RAMDISK == 'true' ]
then
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then echo "Unloading Ramdisk."
mcrd_unload
mcrd_unmount
else echo "Ramdisk already unloaded!"
fi
fi
fi
fi
}
#-------------------+
# Stops the service |
#-------------------+
# Sends notice of impending shutdown as message to minecraft/bukkit console.
# Notifies user if service fails to stop.
#-------------------+
mc_stop() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE is running... stopping."
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $STOP_MSG\"\015'" ; sleep 5
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"save-all\"\015'" ; sleep 10
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"stop\"\015'" ; sleep 3
else echo "$SERVICE was not running."
fi
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE could not be shut down... still running."
else echo "$SERVICE is shut down."
fi
}
#----------------------+
# Disables auto-saving |
#----------------------+
# Sends notice of disablement of auto-saving as message to minecraft/bukkit console.
# Turns off automatic saving.
# Saves all in-game changes and syncs to disk.
#----------------------+
mc_saveoff() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE is running... suspending saves"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $SAVE_OFF_MSG\"\015'"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"save-off\"\015'"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"save-all\"\015'"
sync ; sleep 5
else echo "$SERVICE was not running. Not suspending saves."
fi
}
#---------------------+
# Enables auto-saving |
#---------------------+
# Turns on automatic saving.
# Sends notice of enablement of auto-saving as message to minecraft/bukkit console.
#---------------------+
mc_saveon() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE is running... re-enabling saves"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"save-on\"\015'"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $SAVE_ON_MSG\"\015'"
else echo "$SERVICE was not running. Not resuming saves."
fi
}
#-----------------------------+
# Backup files from $REF_PATH |
#-----------------------------+
# Creates directory tree for backups if it doesn't exist.
# Copies files from $REF_PATH into $REF_BUDIR.
#-----------------------------+
backup() {
echo "Backing Up $REF_BUDIR"
cd $ROOT_BUPATH
if [ ! -d $REF_BUDIR ]
then
as_user "mkdir $ROOT_BUPATH/$REF_BUDIR"
cd $REF_BUDIR
else
cd $REF_BUDIR
fi
# Check for directories with the current datestamp
if ls | grep $DATE > /dev/null
then
cd $DATE
else
as_user "mkdir $ROOT_BUPATH/$REF_BUDIR/$DATE"
cd $DATE
fi
# Check for directories with the curent timestamp.
if ls | grep $TIME > /dev/null
then
TIME="$TIME"_`date "+%S"` # Appened the current seconds time to $bu_time
as_user "mkdir $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME"
as_user "cp -a $REF_PATH/* $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME"
else
as_user "mkdir $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME"
as_user "cp -a $REF_PATH/* $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME"
fi
echo "Backup finished"
}
#------------------------+
# Check backup integrity |
#------------------------+
# Creat directory tree for checksums if it doesn't exist.
# Tarballs reference files and backup files.
# Runs a checksum of the two tarballs seperately.
# Compares the checksums to check intergrity of backup.
#------------------------+
backup_cksum() {
echo "Running checksum..."
cd $ROOT_BUPATH
if [ -d chksum ]
then cd chksum
if [ -d $REF_BUDIR ] # $CS_PATH = $ROOT_BUPATH/chksum/$REF_BUDIR. Since it seems as though we need to
then cd $REF_BUDIR #+ use asbolute paths, we might as well make another variable to lighten the load.
if [ -d reference ]
then
rm -rf reference
as_user "mkdir $CS_PATH/reference"
else
as_user "mkdir $CS_PATH/reference"
fi
if [ -d backup ]
then
rm -rf backup
as_user "mkdir $CS_PATH/backup"
else
as_user "mkdir $CS_PATH/backup"
fi
else
as_user "mkdir $CS_PATH ; cd $CS_PATH"
as_user "mkdir $CS_PATH/reference ; mkdir $CS_PATH/backup"
fi
else
as_user "mkdir $ROOT_BUPATH/chksum ; cd $ROOT_BUPATH/chksum"
as_user "mkdir $CS_PATH ; cd $CS_PATH"
as_user "mkdir $CS_PATH/reference ; mkdir $CS_PATH/backup"
fi
as_user "cd $REF_PATH ; tar -cf checksum.tar *"
as_user "mv $REF_PATH/checksum.tar $CS_PATH/reference"
as_user "cd $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME ; tar -cf checksum.tar *"
as_user "mv $ROOT_BUPATH/$REF_BUDIR/$DATE/$TIME/checksum.tar $CS_PATH/backup"
cd $CS_PATH
REF_checksum=$(ls reference | cksum) # Set $REF_checksum to the value of the checksum of the current worlds' tarball
BACKUP_checksum=$(ls backup | cksum) # Set $BACKUP_checksum to the value of the checksum of the newest backup's tarball
# Compare the values of the checksums
if [ "$REF_checksum" = "$BACKUP_checksum" ]
then
echo "Backup Successful"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $BACKUP_DONE_MSG\"\015'"
else
echo "Backup failed! The reference and backup contents do not match!"
echo "Worlds: $REF_checksum" ; echo "Backup: $BACKUP_checksum"
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $BACKUP_FAIL_MSG\"\015'"
fi
}
#-------------------+
# Mount the ramdisk |
#-------------------+
# Checks status of ramdisk; if ramdisk mounted, notifies user and ends function.
# If the $ROOT_PATH/$RD_DIR doesn't exist, aborts the script.
# If $ROOT_PATH/$RD_DIR exists, mounts ramdisk in that directory as root.
# Gives ownership of data in ramdisk to $USERNAME and $GROUPNAME.
# If ramdisk fails to mount, aborts the script.
#-------------------+
# Will probably add later the ability to make $ROOT_PATH/$RD_DIR if it doesn't exist
mcrd_mount() {
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then echo "Ramdisk already mounted"
else
if [ ! -d $ROOT_PATH/$RD_DIR ]
then echo "Aborting service startup! $ROOT_PATH/$RD_DIR does not exist!" ; exit 1
else echo "Mounting ramdisk at $ROOT_PATH/$RD_DIR"
mount -t tmpfs -o size=$RD_SIZE tmpfs $ROOT_PATH/$RD_DIR
sleep 3
chown $USERNAME:$GROUPNAME $ROOT_PATH/$RD_DIR # Make sure that $USERNAME and members of $GROUPNAME can access the data in the ramdisk
fi
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then echo "Ramdisk mounted at $ROOT_PATH/$RD_DIR"
else echo "Aborting service startup! Could not mount Ramdisk!" ; exit 1
fi
fi
}
#----------------------+
# Unmounts the ramdisk |
#----------------------+
# Checks if ramdisk is mounted at $ROOT_PATH/$RD_DIR.
# If ramdisk is mounted at $ROOT_PATH/$RD_DIR, attempts to unmount as root.
#----------------------+
mcrd_unmount() {
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then echo "Ramdisk mounted at $ROOT_PATH/$RD_DIR.... unmounting"
while mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
do
sleep 2
umount $ROOT_PATH/$RD_DIR
sleep 1
done
echo "Ramdisk unmounted"
else echo "Ramdisk was not mounted at $ROOT_PATH/$RD_DIR"
fi
}
#---------------+
# Loads ramdisk |
#---------------+
# Checks status of service; if service is not running, attempts to load ramdisk.
# Loads all worlds in $WORLD_DIR into ramdisk under "worlds" directory.
# Appends ".old" to symbolic links in $SERVER_DIR/$BUILD which point to $WORLD_DIR.
# Creates symbolic links to $RD_DIR/worlds in $SERVER_DIR/$BUILD.
#---------------+
mcrd_load() {
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null # Is service running?
then echo "Cannot load ramdisk, $SERVICE is running! "
else echo "Loading ramdisk..."
if [ ! -d "$ROOT_PATH/$RD_DIR/worlds" ]
then
as_user "mkdir $ROOT_PATH/$RD_DIR/worlds"
fi
if [ ! -d "$ROOT_PATH/$WORLD_DIR/$WORLD_NAME" ] # Checking for the existance of a world using the name defined in server.properties
then echo "$WORLD_NAME is not in $ROOT_PATH/$WORLD_DIR !" # If no world exists, tell the user
else cd $ROOT_PATH/$WORLD_DIR # If the world does exist, cd to $ROOT_PATH/$WORLD_DIR
for dir in * # For each folder in $ROOT_PATH/$WORLD_DIR,
do
if [ ! -d "$ROOT_PATH/$RD_DIR/worlds/$dir" ] # We are going to make sure it does not reside on the RAMDISK
then javwc=`expr match "$dir" '.*[0-9]'` # Expression to filter out the world backups (ignore something ending with a number)
if [ -d "$dir" ] && [ -f "$ROOT_PATH/$WORLD_DIR/$dir/level.dat" ] && [ $javwc -eq 0 ] # Make sure it is a directory, and that it has a level.dat file in it, and the it IS NOT a backup
then
cp -R $dir $ROOT_PATH/$RD_DIR/worlds # Copy the world from $ROOT_PATH/$WORLD_DIR to $ROOT_PATH/$RD_DIR
chown -R $USERNAME:$GROUPNAME $ROOT_PATH/$RD_DIR/worlds
if [ -d "$ROOT_PATH/$SERVER_DIR/$BUILD/$dir" ] # Are there folders or symlinks already in $ROOT_PATH/$SERVER_DIR/$BUILD?
then as_user "mv $ROOT_PATH/$SERVER_DIR/$BUILD/$dir '$ROOT_PATH/$SERVER_DIR/$BUILD/$dir'.old" # Rename them with the suffix ".old"
fi
as_user "ln -s $ROOT_PATH/$RD_DIR/worlds/$dir $ROOT_PATH/$SERVER_DIR/$BUILD/$dir" # Setup the symlinks to the worlds on the RAMDISK
fi
fi
done
fi # Close if statement "world exist?"
fi # Close if statement "running?"
}
#-----------------+
# Unloads ramdisk |
#-----------------+
# Appends [date +"-%F-%H.%M"] to worlds in $WORLD_DIR
# Copies worlds from ramdisk back to $WORLD_DIR
# Deletes symbolic links in $SERVER_DIR/$BUILD which point to worlds on ramdisk.
# Removes '.old' from symbolic links in $SERVER_DIR/$BUILD which point to $WORLD_DIR.
#-----------------+
mcrd_unload() {
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null # Check if the Ramdisk is mounted
then
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null # Is service running?
then echo "Can't unload ramdisk, $SERVICE is still running!"
else
if [ ! -d "$ROOT_PATH/$RD_DIR/worlds/$WORLD_NAME" ] # Check if $WORLD_NAME (whatevere it was named in server.properties) exists in $ROOT_PATH/$RD_DIR
then echo "Nothing in $ROOT_PATH/$RD_DIR to backup!" # Not found! Warn user!
else echo "Saving ramdisk to disk." # Else we have found something and will continue with the regime, warn user we are beginning
cd $ROOT_PATH/$RD_DIR/worlds # Make sure we are in the $ROOT_PATH/$RD_DIR for the next series of commands
filedate=$(date +"-%F-%H.%M") # Set up our datestamp here.
for dir in * # For each directory inside $ROOT_PATH/$RD_DIR, we are going to perform the following series of commands
do
if [ -d "$dir" ] && [ -f "$dir/level.dat" ] # Make sure it is a directory and verify itis a world by looking for "level.dat" inside of it.
then
if [ -d "$ROOT_PATH/$WORLD_DIR/$dir" ] # Now we check to see if the world folder we found already exists in the $ROOT_PATH/$WORLD_DIR
then
echo "Renaming $dir to $dir$filedate" # We tell the user what we are going to do
as_user "mv $ROOT_PATH/$WORLD_DIR/$dir $ROOT_PATH/$WORLD_DIR/$dir$filedate" # Then rename the found folder with a datestamp on the end of it's name
fi
echo "$dir being copied to disk" # Tell the user we are copying the RAMDISK
as_user "cp -R $ROOT_PATH/$RD_DIR/worlds/$dir $ROOT_PATH/$WORLD_DIR" # Copy the world from $ROOT_PATH/$RD_DIR to $ROOT_PATH/$WORLD_DIR
else echo "Nothing copied from ramdisk." # If no world folders are found, we tell the user.
fi
done # END for loop (directory inside $ROOT_PATH/$RD_DIR)
fi
cd $ROOT_PATH/$SERVER_DIR/$BUILD
for dir in *
do
if [ -d "$dir".old ] && [ -f "$dir/level.dat" ]
then
rm -rf $dir # Remove the links pointing to the world directories on the ramdisk
as_user "cd $ROOT_PATH/$SERVER_DIR/$BUILD ; mv '$dir'.old $dir" # Remove ".old" from the name of the links pointing to the world directories on the hard disk
fi
done
fi
else echo "Nothing to save, ramdisk not mounted at $ROOT_PATH/$RD_DIR" # Service not running, nothing to save
fi
}
#---------------------+
# Commandline parsing |
#---------------------+
# start: Starts the service
# stop: Stops the service
# restart: Restarts the service (if not running, starts the service)
# status: Tells user whether service is running or not
# worldbackup: Runs a backup for worlds in either $WORLD_DIR or $RD_DIR/worlds
# rdbackup: Makes a backup of the entire $RD_DIR directory
#---------------------+
case "$1" in
start)
mc_start
touch $lockfile
;;
stop)
mc_stop
if [ $RAMDISK == 'true' ]
then
mcrd_unload
mcrd_unmount
fi
rm -f $lockfile
;;
restart)
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $RESTART_MSG\"\015'"
mc_stop
mc_start
else
echo "$SERVICE was not running... "
mc_start
fi
;;
status)
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then echo "$SERVICE is running."
else echo "$SERVICE is not running."
fi
;;
backup)
case "$2" in
worlds)
DATE=$(date "+%Y-%m-%d")
TIME=$(date "+%H-%M")
REF_BUDIR="$WORLD_DIR"
CS_PATH="$ROOT_BUPATH/chksum/$WORLD_DIR"
if [ $RAMDISK == 'true' ] && mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then REF_PATH="$ROOT_PATH/$RD_DIR/worlds"
else REF_PATH="$ROOT_PATH/$WORLD_DIR"
fi
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $BACKUP_START_MSG\"\015'"
fi
mc_saveoff
backup
backup_cksum
mc_saveon
;;
ramdisk)
DATE=$(date "+%Y-%m-%d")
TIME=$(date "+%H-%M")
REF_BUDIR="$RD_DIR"
CS_PATH="$ROOT_BUPATH/chksum/$RD_DIR"
REF_PATH="$ROOT_PATH/$RD_DIR"
if ps ax | grep -v grep | grep -v -i SCREEN | grep $SERVICE > /dev/null
then
as_user "screen -p 0 -S $SCREEN_NAME -X eval 'stuff \"say $BACKUP_RD_START_MSG\"\015'"
fi
if mount -l -t tmpfs | grep $ROOT_PATH/$RD_DIR > /dev/null
then
mc_saveoff
backup
backup_cksum
mc_saveon
else echo "Ramdisk not mounted, nothing to do."
fi
;;
*)
echo "Usage /etc/init.d/minecraft backup {worlds|ramdisk}"
exit 1
;;
esac
;;
*)
echo "Usage: /etc/init.d/minecraft {start|stop|restart|status|worldbackup|rdbackup}"
exit 1
;;
esac
exit 0