Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Ramdisk populator
- RAM_DISK_SIZE=1300m
- MOUNT_POINT=/home/monstercraft/Ramdisk_reg
- SOURCE_DIR=/olddrive/WORLD_BACKUPS/Minecraft_folder_ram
- # Does the mount point exist
- mkdir -p $MOUNT_POINT;
- # Create the tmpfs on mount point
- mount -o size=$RAM_DISK_SIZE -t tmpfs tmpfs $MOUNT_POINT
- # Copy the source files to the mounted tmpfs
- cp -rp $SOURCE_DIR/* $MOUNT_POINT
- #######################################################
- # +++++++++++ Now Im going to check MySQL +++++++++++ #
- # +++++++ because Server will start without it ++++++ #
- # +++++++ and throw 40000MB a second of errors ++++++ #
- #######################################################
- USER=derpina
- PASS=derpaherp
- #######################################################
- # +++++++++++++++ Important stuff +++++++++++++++++++ #
- #######################################################
- #Invokes the McMyAdmin startup script in a detached screen.
- function StartServer {
- su monstercraft -c 'cd /home/monstercraft/Monstercraft && screen -dmS Mine ./start.sh'
- }
- # Check if the MySQL server is alive
- function CheckServer {
- $CMD -u $USER -p$PASS ping | grep -c 'alive'
- }
- CMD=/usr/bin/mysqladmin
- START="/etc/init.d/mysqld start"
- TRIES=10
- if [ "$(CheckServer)" != "1" ]; then
- # Try and start MySQL 10 times
- until [ $TRIES -eq 0 ]; do
- # Start MySQL
- $START
- sleep 30
- # $START will return once MySQL has started, or failed to start
- # Did it start?
- if [ '$(CheckServer)' == "1" ]; then
- # Yippee, start the MC server and exit
- StartServer
- exit
- fi
- let TRIES=$(( $TRIES -1))
- done
- else
- StartServer
- fi
Add Comment
Please, Sign In to add comment