Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script crashes every time i log out #12

Closed
flaminSaganaki opened this issue Oct 1, 2011 · 18 comments
Closed

Script crashes every time i log out #12

flaminSaganaki opened this issue Oct 1, 2011 · 18 comments

Comments

@flaminSaganaki
Copy link

Hi i was hoping you could help me with my problem. I have gotten the script running well, though I access my server with putty through ssh. Everytime i log out of ssh while server is running, it crashes and just stops working. I have tried running it in a screen as well as nohup to no avail. PLEASE HELP ME ive been struggling with this for days now. Thanks!

@karrth
Copy link

karrth commented Oct 1, 2011

When you access your server, are you sshing in as the minecraft account? When you exit, what are you doing? Just closing the putty window?

@flaminSaganaki
Copy link
Author

I'm simply logging in as my user. Not root. As for exiting. I type exit in the console and I also use winscp so I just logout of that too. Thanks for the help!
Ted
-----Original Message-----
From: karrth reply@reply.github.com
Date: Sat, 1 Oct 2011 16:44:18
To: tjmavrakis@live.com
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

When you access your server, are you sshing in as the minecraft account?  When you exit, what are you doing?  Just closing the putty window?

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 1, 2011

Ok... some more detail would be great:

  1. When using the script, who are you calling it as?
  2. What distro are you running, and where do you have the script located/what permissions?
  3. You say you tried running it in screen - do you mean you're running screen, then starting the script, ctrl-a-d, and exiting? Or are you referring to the script's implementation of screen?
  4. Do you have any log files you could post with relevant crash data?

@flaminSaganaki
Copy link
Author

  1. Calling it as? If you mean the username, its "theodore". Also I set that as the username in the variables section of the script.
  2. Ubuntu server 64 bit
  3. Well I normally ran mc in a screen before I found this script. So, basically at first I tried running your script outside of a screen, just like in the normal terminal that never worked out of course cause it shut down when I exited. So I tried starting the script in a screen, which again crashed when I exited ssh. Finally I tried it with uhup but that didn't work either.
  4. I am away from home at the moment so I will send you a copy of the log later today.

Thanks again!
Ted
-----Original Message-----
From: karrth reply@reply.github.com
Date: Sat, 1 Oct 2011 16:58:27
To: tjmavrakis@live.com
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

Ok... some more detail would be great:

  1. When using the script, who are you calling it as?
  2. What distro are you running, and where do you have the script located/what permissions?
  3. You say you tried running it in screen - do you mean you're running screen, then starting the script, ctrl-a-d, and exiting?  Or are you referring to the script's implementation of screen?
  4. Do you have any log files you could post with relevant crash data?

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 1, 2011

Please copy/paste your terminal output, from logging in, starting the server, to logging out.

If you're running Ubuntu, then it should be in /etc/init.d/, and you should be able to call it by
$ /etc/init.d/minecraft [command]
as root (or with sudo). Are you running the script in this fashion?

@flaminSaganaki
Copy link
Author

Login:

Using username "theodore".
theodore@192.168.0.04's password:
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-11-server x86_64)

  • Documentation: http://www.ubuntu.com/server/doc

    System information as of Sat Oct 1 22:16:30 CDT 2011

    System load: 0.0 Processes: 89
    Usage of /: 14.5% of 109.06GB Users logged in: 0
    Memory usage: 30% IP address for eth0: 192.168.0.4
    Swap usage: 0%

    Graph this data and manage this system at https://landscape.canonical.com/
    Last login: Sat Oct 1 18:00:50 2011 from 32.164.51.100
    theodore@Server:~$

Mounting ramdisk:
theodore@Server:$ sudo mount -t ramfs –o size=700M ramfs /tmp/ramdisk0
theodore@Server:
$

Permissions:
theodore@Server:$ sudo chmod 777 /tmp/ramdisk0
theodore@Server:
$

Starting server:
theodore@Server:$ /etc/init.d/minecraft start
created link for world
created link for world_nether
links checked
world copied to ram
craftbukkit.jar was not running... starting.
craftbukkit.jar is now running.
theodore@Server:
$

Loggin Out:
theodore@Server:~$ exit

Script Settings:
#!/bin/bash

/etc/init.d/minecraft

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: Init script for minecraft/bukkit server, with rolling logs and use of ramdisk for less lag.

END INIT INFO

Created by Ahtenus

Based on http://www.minecraftwiki.net/wiki/Server_startup_script

Support for multiworld by Benni-chan

#############################
######### SETTINGS ##########
#############################

Name of server.jar file

SERVICE="craftbukkit.jar"

Name to use for the screen instance

SCREEN="minecraft"

User that should run the server

USERNAME="theodore"

Path to minecraft directory

MCPATH="/home/${USERNAME}/minecraft"

Number of CPUs/cores to use

CPU_COUNT=1

Initial memory usage

INITMEM="1024M"

Maximum amount of memory to use

MAXMEM="2G"

Remember: give the ramdisk enough space, subtract from the total amount

of RAM available the size of your map and the RAM-consumption of your base system.

INVOCATION="java -Xincgc -Xmx$MAXMEM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE nogui"

Where the world backups should go

BACKUPPATH="/home/${USERNAME}/minebak"

Where the logs are copied with log-roll

LOGPATH="${MCPATH}/logs"

Where the whole minecraft directory is copied when whole-backup is executed

WHOLEBACKUP="/home/${USERNAME}/serverbak"

Where the worlds are located on the disk. Can not be the same as MCPATH.

WORLDSTORAGE="${MCPATH}/worldstorage"

Path to the the mounted ramdisk default in Ubuntu: /dev/shm

RAMDISK="/tmp/ramdisk0"

use tar or zip files for world backup

BACKUPFORMAT="tar"

Thanks!
Ted

-----Original Message-----
From: karrth
Sent: Saturday, October 01, 2011 3:07 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

Please copy/paste your terminal output, from logging in, starting the server, to logging out.

If you're running Ubuntu, then it should be in /etc/init.d/, and you should be able to call it by
$ /etc/init.d/minecraft [command]
as root, or theodore. Are you running the script in this fashion?

Reply to this email directly or view it on GitHub:
#12 (comment)

@flaminSaganaki
Copy link
Author

ah yes and here is the error message I see when I reconnect to the screen after exiting the ssh session and reentering:

2011-10-01 22:43:23 [INFO] Starting minecraft server version Beta 1.8.1
2011-10-01 22:43:23 [INFO] Loading properties
2011-10-01 22:43:23 [INFO] Starting Minecraft server on 192.168.0.4:25565
2011-10-01 22:43:23 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
2011-10-01 22:43:23 [WARNING] The server will make no attempt to authenticate usernames. Beware.
2011-10-01 22:43:23 [WARNING] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
2011-10-01 22:43:23 [WARNING] To change this, set "online-mode" to "true" in the server.settings file.
2011-10-01 22:43:23 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-1067-g6301507-b1185jnks (MC: 1.8.1)
2011-10-01 22:43:25 [INFO] Permissions was initialized.
2011-10-01 22:43:25 [INFO] [Permissions] version 3.1.6 loaded
2011-10-01 22:43:25 [INFO] Preparing level "world"
2011-10-01 22:43:25 [INFO] Default game type: 0
2011-10-01 22:43:25 [INFO] Preparing start region for level 0 (Seed: 2966333191080911398)
2011-10-01 22:43:26 [INFO] Preparing spawn area: 77%
2011-10-01 22:43:27 [INFO] Preparing start region for level 1 (Seed: -6479264295887347296)
2011-10-01 22:43:27 [INFO] Preparing spawn area: 89%
2011-10-01 22:43:28 [INFO] AntiCreeper v2.0 - by Rothens
2011-10-01 22:43:28 [INFO] Anticreeper v2.0 - STARTED
2011-10-01 22:43:28 [INFO] PickBoat version 0.3.6 is enabled!
2011-10-01 22:43:28 [INFO] [Fight] Plugin Started. (version 1.1.4)
2011-10-01 22:43:28 [INFO] InventorySave by Master24 v0.5 enabled!
2011-10-01 22:43:28 [INFO] CraftBookMechanisms 3.0-alpha2 enabled.
2011-10-01 22:43:28 [INFO] CraftBookMechanisms: Permissions plugin detected! Using Permissions plugin for permissions.
2011-10-01 22:43:28 [INFO] 1 cauldron recipe(s) loaded
2011-10-01 22:43:28 [INFO] CraftBookCircuits 3.0-alpha2 enabled.
2011-10-01 22:43:28 [INFO] CraftBookCircuits: Permissions plugin detected! Using Permissions plugin for permissions.
2011-10-01 22:43:28 [INFO] CraftBookCircuits: Permissions plugin detected! Using Permissions plugin for permissions.
2011-10-01 22:43:28 [INFO] CraftBookVehicles 3.0-alpha2 enabled.
2011-10-01 22:43:28 [INFO] CraftBookVehicles: Permissions plugin detected! Using Permissions plugin for permissions.
2011-10-01 22:43:28 [INFO] CraftBookCommon 3.0-alpha2 enabled.
2011-10-01 22:43:28 [INFO] CraftBookCommon: Permissions plugin detected! Using Permissions plugin for permissions.
2011-10-01 22:43:28 [INFO] [AdminCmd] Plugin Enabled. (version 5.9 (BUILD 25.09.2011 @ 17:55:00))
2011-10-01 22:43:28 [INFO] [AdminCmd] 88 extra help entries loaded from files: AdminCmd(88)
2011-10-01 22:43:29 [INFO] [AdminCmd] 2 blacklisted items loaded.
2011-10-01 22:43:29 [INFO] [AdminCmd] 1655 alias loaded.
2011-10-01 22:43:29 [INFO] [AdminCmd] 2 kits loaded.
2011-10-01 22:43:29 [INFO] [AdminCmd] 0 banned players loaded.
2011-10-01 22:43:29 [INFO] [AdminCmd] Successfully linked with Yeti's Permissions.
2011-10-01 22:43:29 [INFO] Server permissions file permissions.yml is empty, ignoring it
2011-10-01 22:43:30 [INFO] Done (0.480s)! For help, type "help" or "?"
2011-10-01 22:43:31 [INFO] DontBeBeech [/70.232.160.183:51909] logged in with entity id 95 at ([world] -2049.767547451045, 32.50672773251637, -2418.717365337946)
2011-10-01 22:43:32 [INFO] New max size: 484
2011-10-01 22:43:32 [INFO] New max size: 784
2011-10-01 22:43:35 [INFO] BrewsterWill [/76.202.238.129:61693] logged in with entity id 1176 at ([world] -2048.30000001192, 39.434979731933865, -2523.699999988079)
2011-10-01 22:43:36 [INFO] Ginger159 [/67.162.32.191:54169] logged in with entity id 1252 at ([world] -168.00966701678593, 79.0, -47.679265012609044)
2011-10-01 22:44:19 [SEVERE] net.minecraft.server.MinecraftException: Failed to check session lock, aborting
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.PlayerNBTManager.b(PlayerNBTManager.java:71)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.World.j(World.java:2404)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.World.w(World.java:241)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.World.save(World.java:231)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.World.doTick(World.java:1633)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
2011-10-01 22:44:19 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
2011-10-01 22:44:19 [SEVERE] Unexpected exception
net.minecraft.server.MinecraftException: Failed to check session lock, aborting
at net.minecraft.server.PlayerNBTManager.b(PlayerNBTManager.java:71)
at net.minecraft.server.World.j(World.java:2404)
at net.minecraft.server.World.w(World.java:241)
at net.minecraft.server.World.save(World.java:231)
at net.minecraft.server.World.doTick(World.java:1633)
at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:454)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)

Thanks,
Ted

-----Original Message-----
From: karrth
Sent: Saturday, October 01, 2011 3:07 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

Please copy/paste your terminal output, from logging in, starting the server, to logging out.

If you're running Ubuntu, then it should be in /etc/init.d/, and you should be able to call it by
$ /etc/init.d/minecraft [command]
as root, or theodore. Are you running the script in this fashion?

Reply to this email directly or view it on GitHub:
#12 (comment)

@flaminSaganaki
Copy link
Author

I saw you mentioned running the script as sudo. Well i just tried that and it didnt make any difference. Though is this script made to be run in uhup or a screen, apart of course from the server.jar?
In other words, does this script have to be run through a seperate screen instance or nohup, or should it be able to simply run straight from the terminal, and the ssh connection closed.

@karrth
Copy link

karrth commented Oct 2, 2011

It is meant to be run exactly as you are running it - by calling /etc/init.d/minecraft start
If you look in the script, it calls screen automatically. Which brings me to my next request - if you start it manually, what happens? type this into your terminal and let me know what happens:

cd /home/theodore/minecraft/
screen -dmS minecraft java -Xmx1024M -Xms1024M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=1 -XX:+AggressiveOpts -jar craftbukkit.jar nogui

Do you see where this comes from in the script? EDIT: I forgot to change the CPU_COUNT

It should kick off a screen session in the background, just like the script is intended to do. Try bringing up the screen, and then hiding it again. Start another concurrent session up, and do a tail -f /home/theodore/minecraft/server.log
Then log out of your original session that you started screen up with. Does it crash right when you log out? If not, log out of the second session, log back in and see if it crashed.

More possibly helpful questions:
1a) Did this just happen when you switched to 1.8.1?
1b) If so, did you use the same old world, or a new one?
2) I noticed you have "Xincgc" option in your java statement in your conf. Is this something you added? Did you have this problem before this?

@flaminSaganaki
Copy link
Author

Okay I followed your instructions, and I can tell you that when viewing the
log from the concurrent session, nothing happened when I logged out and back
in. It seems that as long as the ssh connection is alive, it continues to
run as normal.
Second, I began using this script shortly after 1.8.1 server came out. So I
never used it with 1.7. Also, it has never NOT given me this problem, so it
isnt as if this has just started up, if that helps you understand at all.

As for the revision to the INVOCATION variable in the script, yes I made
that change, and it hasn’t acted differently before than after.
I am using my old worlds, which worked fine before I used this script, so I
don’t believe it’s a prob with the worlds.

Thanks,
Ted

-----Original Message-----
From: karrth
Sent: Saturday, October 01, 2011 11:00 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

It is meant to be run exactly as you are running it - by calling
/etc/init.d/minecraft start
If you look in the script, it calls screen automatically. Which brings me
to my next request - if you start it manually, what happens? type this into
your terminal and let me know what happens:

cd /home/theodore/minecraft/
screen -dmS minecraft
java -Xmx1024M -Xms1024M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=3
-XX:+AggressiveOpts -jar craftbukkit.jar nogui

Do you see where this comes from in the script?

It should kick off a screen session in the background, just like the script
is intended to do. Try bringing up the screen, and then hiding it again.
Start another concurrent session up, and do a tail -f
/home/theodore/minecraft/server.log
Then log out of your original session that you started screen up with. Does
it crash right when you log out? If not, log out of the second session, log
back in and see if it crashed.

More possibly helpful questions:
1a) Did this just happen when you switched to 1.8.1?
1b) If so, did you use the same old world, or a new one?
2) I noticed you have "Xincgc" option in your java statement in your conf.
Is this something you added? Did you have this problem before this?

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 2, 2011

Did it crash after logging out of both sessions when you ran the command manually?

Also, it's generally a good idea to star our your IP addresses (at least your public ones), or at least the last 2 or 3 octets. Otherwise some jerk-off will know what server version you're running at what ip with what software, and might decide to be an asshole. You never know.

@flaminSaganaki
Copy link
Author

When I logged out of the second session it crashed as well.

I was thinking, I don’t run ramdisk on /dev/shm. Instead like I showed
earlier, I run it on /tmp/ramdisk0 which is a directory I made. Could that
have something to do with my problem? If it's dependent on my user account,
and I log off, then maybe it cant access the ramdisk anymore? I'm just tryin
to think of something....
Thanks again for all your help on this, I really appreciate it.
Ted

-----Original Message-----
From: karrth
Sent: Saturday, October 01, 2011 11:43 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

Did it crash after logging out of both sessions when you ran the command
manually?

Reply to this email directly or view it on GitHub:
#12 (comment)

@flaminSaganaki
Copy link
Author

Okay, I finally got it to work....

So, since I had a feeling the prob had to do with my username (its use in
the script), I moved the mc folder into simply /opt/minecraft. So I avoided
going through /home/user at all. When I moved everything and started the
script, the server started, and did NOT crash when I logged out later.
Of course it works as a fix, though I would have liked to simply have run
the server from my user folder....

I suppose I should thank you for all your time and effort into solving my
problem, though one could say it hasn’t exactly been *solved yet. I greatly
appreciate your help and the script of course itself.
Thanks,
Ted

-----Original Message-----
From: karrth
Sent: Saturday, October 01, 2011 11:43 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

Did it crash after logging out of both sessions when you ran the command
manually?

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 2, 2011

You're right! I totally missed that for some reason. I putting the mountpoint in /tmp might be the problem, but either way I don't see the reason for it. Why not just mount it in the same server folder so everything is in one place?

@flaminSaganaki
Copy link
Author

Hmm well how would you personally go about mounting the ramdisk for the script. Because the instructions on github were rather vague about the ramdisk stuff.
Also, would having it in the same dir as the server make it run faster or better in any way?
Thanks,
Ted
-----Original Message-----
From: karrth reply@reply.github.com
Date: Sun, 2 Oct 2011 06:35:19
To: tjmavrakis@live.com
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

You're right! I totally missed that for some reason.  I putting the mountpoint in /tmp might be the problem, but either way I don't see the reason for it.  Why not just mount it in the same server folder so everything is in one place?

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 2, 2011

I just put symlinks called world and world_nether to corresponding folder in the already mounted ramdisk at /dev/shm.

I would only recommend mounting in the sever folder for organizational reasons - it won't run any faster or slower. The real issue that will effect your speed is actually using the ramdisk by putting your worlds, or some other disk-intensive data on there. The extra mounting of another ramdisk is unnecessary.

Example of what I would do:
cd /home/theo/minecraft/
mv world world.backup && mv world_nether world_nether.backup
ln -s /dev/shm/world /home/theo/minecraft/world/ && ln -s /dev/shm/world_nether /home/theo/minecraft/world_nether

@flaminSaganaki
Copy link
Author

Alright, thanks for the info.

Now, I wanted to make a feature request that you could probably add within
10 mins or so. In the world backup folder that I have, it is cluttered with
many backups. I was wondering if you might be able to have the script make a
folder for each day, within the main world backups folder. So for every day,
the script makes a new folder labeled with the date that would contain all
the backups for that day. It would be much more organized and convenient.
Also, ive used a backup script in which the user can set a variable of a
number of days before some backups are deleted. For example if I set it to
5, after 5 days, all the backups older than 5 days would be deleted. Again
this is for keeping the folder clean etc.
Btw, now that ive got it working, the script has been fantastic so far with
the ramdisk support etc.
Thanks,
Ted

-----Original Message-----
From: karrth
Sent: Sunday, October 02, 2011 2:40 PM
To: flaminSaganaki
Subject: Re: [minecraft-init] Script crashes every time i log out (#12)

I just put symlinks called world and world_nether to corresponding folder in
the already mounted ramdisk at /dev/shm.

I would only recommend mounting in the sever folder for organizational
reasons - it won't run any faster or slower. The real issue that will
effect your speed is actually using the ramdisk by putting your worlds, or
some other disk-intensive data on there. The extra mounting of another
ramdisk is unnecessary.

Example of what I would do:
cd /home/theo/minecraft/
mv world world.backup && mv world_nether world_nether.backup
ln -s /dev/shm/world /home/theo/minecraft/world/ && ln -s
/dev/shm/world_nether /home/theo/minecraft/world_nether

Reply to this email directly or view it on GitHub:
#12 (comment)

@karrth
Copy link

karrth commented Oct 4, 2011

Last I checked, this script already does that - either that or I'm misunderstanding what you're asking.

As for the feature request, I'll take a gander at it, but it's up to Ahtenus to toss it in or not. You can always start your own fork and give it a go! There are many forks of this script (including one of my own), so be sure to check them out - maybe somebody has already implemented the feature you want!
https://github.com/Ahtenus/minecraft-init/network/members

@Ahtenus Ahtenus closed this as completed Dec 5, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants