Jump to content

Roelof

Members
  • Posts

    1
  • Joined

  • Last visited

About Roelof

  • Birthday 01/16/1994

Contact Methods

  • Website URL
    http://www.tmg-clan.com/

Roelof's Achievements

Dirt

Dirt (1/9)

0

Reputation

  1. Here's a short manual for if you don't want to use FileZilla but do have access via SSH: We'll start by making ourself root using sudo, if you login using the root username (which is generally a bad habbit) you can skip this step. sudo su You'll probably be asked for your password Now lets continue by going into a shared location and creating a new tekkit folder cd /usr/share/ mkdir tekkit cd tekkit wget http://mirror.technicpack.net/files/Tekkit_Server_3.1.1.zip Now we'll install unzip, if you already have unzip (and can run an unzip command you can skip this step) sudo apt-get install unzip Now we unzip the server, so all files are moved to ~/tekkit/ unzip Tekkit_Server_3.1.1.zip And now we remove the downloaded zip file, we already extracted it's contents rm Tekkit_Server_3.1.1.zip From here on, you can follow Ronneke's guide, I posted it below with some modifications to clear certain things up. echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list.d/webupd8team-java.list Update apt and get java via apt-get. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 apt-get update apt-get install oracle-java7-installer You will have to accept to a license from Oracle, Click OK and Yes when prompted Test if you have java by running java -version It should display something like java version "1.7.0_10" Java SE Runtime Environment (build 1.7.0_10-b18) Java HotSpot 64-Bit Server VM (build 23.6-b04, mixed mode) Should you get errors, make sure you've installed java correctly Now, get the screen package apt-get install screen And make a new screen for Minecraft (well... Tekkit in this case) screen -S minecraft I had some errors when launching lauch.sh so I simply entered this in my terminal and hit enter java -Xmx768M -Xms512M -jar /usr/share/tekkit/Tekkit.jar nogui Making the server auto-boot on system start Make sure the server isn't running before you start doing this, else you might end up with two servers running at the same time which will not go very well (you will screw up your server and the world) To make the system start the Tekkit server automatically on system boot we need to do the following; Go to the daemon directory cd /etc/init.d/ Create a new file, I use nano but you can use any editor you like. nano -w tekkit Now paste the following (in PuTTY, it's done by regularly copying the following code and then right-clicking on the Terminal screen) #!/bin/bash # /etc/init.d/tekkit # version 0.3.9 2012-08-13 (YYYY-MM-DD) ### BEGIN INIT INFO # Provides: tekkit # 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: Tekkit server # Description: Starts the tekkit server ### END INIT INFO #Settings SERVICE='Tekkit.jar' OPTIONS='nogui' USERNAME='root' WORLD='world' MCPATH='/usr/share/tekkit' BACKUPPATH='/usr/share/tekkit/backup/tekkit.backup' MAXHEAP=2048 MINHEAP=1024 HISTORY=1024 CPU_COUNT=1 INVOCATION="java -Xmx${MAXHEAP}M -Xms${MINHEAP}M -XX:+UseConcMarkSweepGC \ -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts \ -jar $SERVICE $OPTIONS" ME=`whoami` as_user() { if [ $ME == $USERNAME ] ; then bash -c "$1" else su - $USERNAME -c "$1" fi } mc_start() { if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "$SERVICE is already running!" else echo "Starting $SERVICE..." cd $MCPATH as_user "cd $MCPATH && screen -h $HISTORY -dmS minecraft $INVOCATION" sleep 7 if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "$SERVICE is now running." else echo "Error! Could not start $SERVICE!" fi fi } mc_saveoff() { if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "$SERVICE is running... suspending saves" as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP STARTING. Server going readonly...\"\015'" as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-off\"\015'" as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'" sync sleep 10 else echo "$SERVICE is not running. Not suspending saves." fi } mc_saveon() { if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "$SERVICE is running... re-enabling saves" as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-on\"\015'" as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP ENDED. Server going read-write...\"\015'" else echo "$SERVICE is not running. Not resuming saves." fi } mc_stop() { if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "Stopping $SERVICE" as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN IN 10 SECONDS. Saving map...\"\015'" as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'" sleep 10 as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'" sleep 7 else echo "$SERVICE was not running." fi if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "Error! $SERVICE could not be stopped." else echo "$SERVICE is stopped." fi } mc_backup() { mc_saveoff NOW=`date "+%Y-%m-%d_%Hh%M"` BACKUP_FILE="$BACKUPPATH/${WORLD}_${NOW}.tar" echo "Backing up minecraft world..." #as_user "cd $MCPATH && cp -r $WORLD $BACKUPPATH/${WORLD}_`date "+%Y.%m.%d_%H.%M"`" as_user "tar -C \"$MCPATH\" -cf \"$BACKUP_FILE\" $WORLD" echo "Backing up $SERVICE" as_user "tar -C \"$MCPATH\" -rf \"$BACKUP_FILE\" $SERVICE" #as_user "cp \"$MCPATH/$SERVICE\" \"$BACKUPPATH/minecraft_server_${NOW}.jar\"" mc_saveon echo "Compressing backup..." as_user "gzip -f \"$BACKUP_FILE\"" echo "Done." } mc_command() { command="$1"; if pgrep -u $USERNAME -f $SERVICE > /dev/null then pre_log_len=`wc -l "$MCPATH/server.log" | awk '{print $1}'` echo "$SERVICE is running... executing command" as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'" sleep .1 # assumes that the command will run and print to the log file in less than .1 seconds # print output tail -n $[`wc -l "$MCPATH/server.log" | awk '{print $1}'`-$pre_log_len] "$MCPATH/server.log" fi } #Start-Stop here case "$1" in start) mc_start ;; stop) mc_stop ;; restart) mc_stop mc_start ;; backup) mc_backup ;; status) if pgrep -u $USERNAME -f $SERVICE > /dev/null then echo "$SERVICE is running." else echo "$SERVICE is not running." fi ;; command) if [ $# -gt 1 ]; then shift mc_command "$*" else echo "Must specify server command (try 'help'?)" fi ;; *) echo "Usage: $0 {start|stop|backup|status|restart|command \"server command\"}" exit 1 ;; esac exit 0 Great, now we have the file. Before it works however, we need to run two more commands. chmod a+x /etc/init.d/tekkit update-rc.d tekkit defaults This will fix the rights on the file and then add the file to the boot sequence of the system. The system might warn you about the script not meeting certain requirements, you can ignore this, the script will work. Now we installed the server daemon, we can start the server. This is done by running the following /etc/init.d/tekkit start (This is executed automatically when the system starts) For more info on available commands do /etc/init.d/tekkit You'll get a list of all the available commands. Getting the server to back-up every 30 minutes This will only work if you installed the script mentioned above. Enter crontab to create a cronjob crontab -e Add a new line at the end of the file 0,30 * * * * /etc/init.d/tekkit backup . This will make the server make a backup at :00 and :30 of every hour (unless the server is offline). If you want to make this an hour, set the first bit that says "0,30" to "0". You can lookup crontab's manual for more details. If you executed the "sudo su" bit at the beginning of this tutorial be sure to type the following and hitting enter: exit . Good luck! I can't guarantee that this will work on every system, just try some things out.
×
×
  • Create New...