Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

Server startup script


  • Please log in to reply
2 replies to this topic

#1

Infinitive
  • Location: Netherlands
  • Minecraft: Infinitive

Posted 23 April 2011 - 09:14 PM

Hi, I just got a vps and installed java and my server. But how can I start my server up and close the SSH client window without the server shutting down? I used to have a line and that had screen -r or screen -s in it. Does anyone have it?
asd

Register or log in to remove.

#2

Infinitive
  • Location: Netherlands
  • Minecraft: Infinitive

Posted 24 April 2011 - 09:01 AM

Anyone? I really need this.
asd

#3

westmn
    westmn

    Redstone Miner

  • Members
  • 542 posts

Posted 24 April 2011 - 09:11 AM

Guess your running the server on a linux machine with screen installed so you'll just have to type "screen" then start your server with the normal script.
screen is a linux application that runs programs and allows you to disconnect-reconnect to your "screen" with the programs still running, it's awesome!

here is my server startup script:

#!/bin/bash
LOGDIR=/home/west/Logs/$(date +%:Diamond:
LOG=$LOGDIR/$(date +%b-%d_%T)-server.log
if [ ! -d $LOGDIR ]; then mkdir $LOGDIR; fi
if [ -f server.log ]; then mv server.log $LOG; fi
if [ -f server.log.* ]; then rm server.log.*; fi
if [ -f $(ls worldedit.log*) ]; then rm worldedit.log*; fi
screen java -Xms4096M -Xmx6114M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui

As you can see you can also just type screen with whatever command (like start the server).
If you wana see your screen later just use

screen -ls
this will show the screens available, then use
screen -r [screen name from list]
This will connect to a screen. If for some reason your screen show attached (not detached) then you'll have to connect to it like this:
screen -dr [screen name from list]

If you log into SSH and you know you only have one screen running you can just type
screen -drr

to force a connection to the screen without entering the screen name.

If you want some more info on the wonderful screen app use google!
Hope this all made sense, good luck!
My public free build survival server:
Posted Image