Ahtenus / minecraft-init

Init script for minecraft and bukkit servers
404 stars 125 forks source link

Grep #128

Open iaidan opened 11 years ago

iaidan commented 11 years ago

Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. Rogue pidfile found!

Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information.

...

SIGINIT CALLED - FORCE EXITING! KILLING SERVER PROCESSES!!! Killing PID: 6517 Killing PID: 6518

The above is the error message i get when trying to do sudo /etc/init.d/minecraft start from my ssh client, i have google'd for ages now still no fix, even tried to modify the code with other methods of getting the pid with no result. Could you please take a look at this for me?

Thanks, Aidan Taylor

jbondhus commented 11 years ago

You’re not supposed to run the script as root, just a heads up…

Evanion commented 11 years ago

I'm getting the same when I run the script as the user that should run the server:

[bukkit@matterhorn init]$ ./minecraft start Användning: grep [FLAGGA]... MÖNSTER [FIL]... Försök med "grep --help" för mer information Rogue pidfile found! Användning: grep [FLAGGA]... MÖNSTER [FIL]... Försök med "grep --help" för mer information Användning: grep [FLAGGA]... MÖNSTER [FIL]... Försök med "grep --help" för mer information Användning: grep [FLAGGA]... MÖNSTER [FIL]... Försök med "grep --help" för mer information Användning: grep [FLAGGA]... MÖNSTER [FIL]... Försök med "grep --help" för mer information ^C SIGINIT CALLED - FORCE EXITING! KILLING SERVER PROCESSES!!!

When I change the following lines in the config file to the following values, and start the service as root it works... Am I missing something?

# User that should run the server
USERNAME="root"

# Path to minecraft server directory
# MCPATH="/home/${USERNAME}/server"
MCPATH="/home/bukkit/server"
cridenour commented 11 years ago

Likely a permission error on the craftbukkit.jar file. (That was my issue)

Evanion commented 11 years ago

-rw-rw-r-- 1 bukkit bukkit 12960396 9 maj 11.50 craftbukkit.jar

Evanion commented 11 years ago

running: $ chmod 644 craftbukkit.jar $ chmod +x craftbukkit.jar still produce the same error message when trying to run it as the bukkit user.

joeracker commented 11 years ago

I had this issue and realized I did not have java installed. On Ubuntu, you can pretty easily: sudo apt-get install openjdk-6-jre-headless

Evanion commented 11 years ago

no, thats not it :(

[root@matterhorn ~]# java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

[Edit]: How ever.. your comment made me think .. and when i su as the intended user:

[bukkit@matterhorn /]$ java -version bash: java: kommandot finns inte (command does not exist)

Evanion commented 11 years ago

Yes! That was it ... I forgot to add java to the users jk environment (running cagefs/LVE on the server). a simple 'whereis java' and adding them to a cfg file and updating cagefs solved the issue. I now have bukkit running in a safe and limited environment.

Considering the popularity of attacking MC servers, and the fact that we are running unstable bukkit releases, I really didn't want it running as root. Now I can limit I/O, CPU, RAM etc without problem.

penguincoder commented 9 years ago

This issue happens for me consistently if minecraft is started too early in the boot process and /var has not been mounted by udev. The script is attempting to locate any processes that are java that might be in the screen directory (/var/run/screen) and grep can't open the directory since it doesn't exist.

I fixed this by adding $all to the end of the line of Required-Start: and that makes it start later in the boot process.

jbondhus commented 9 years ago

This script hasn't been updated for almost two years. It should be considered depreciated and no longer used. There are variants of it written in other languages that are more effective and easier to use. This is probably the best one.

Leopere commented 9 years ago

@jbondhus this repo still works perfectly. @gsand's fork of Mark2 is great for people who want an entire wrapper this is completely different from a wrapper though its just a simple Init.d (LSB) script which just starts and stops an MC Daemon that it creates. Mark2 requires a lot of deps and has no Init or variant.

jbondhus commented 9 years ago

Ok, if it works for you that's fine. I wasn't aware that Mark2 doesn't have LSB support. I might want to fork it and put that in myself (as well as automatic dependency installation), but I'm pretty busy and it's been a while since I've run a minecraft server. I used to be one of the maintainers for this project though, so if you do have any problems with it get in touch with me and I'll see what I can do. No guarantees though, I've been pretty busy lately. :)

penguincoder commented 9 years ago

I agree with @chamunks. I just use this as a way to start a MC server. I don't really need anything else. I will make a PR for the $all change I was talking about. It's the only thing that needs changing.

jbondhus commented 9 years ago

Ok, cool. I'm not sure of Ahtenus has been responding to pull requests. If there's anybody who would like to take on maintenance of this project they should touch base with Ahtenus and request that they be added to the list of people who can administer the project.

Leopere commented 9 years ago

@jbondhus realistically someone should just fork the project it doesn't seem like anyones really pushing this one any longer.

I mean I would almost want to see an Systemd unit file added next to this script. It has loads more things like metrics built in and remote control and launch time audit etc etc etc...

Leopere commented 9 years ago

In fact if anyone wants to add themselves as a maintainer on https://github.com/chamunks/minecraft-init I would be willing to allow them access or something like that.

penguincoder commented 9 years ago

I wouldn't mind being a maintainer on this project.

Leopere commented 9 years ago

@penguincoder sure I apologize for taking as long as I did.

penguincoder commented 9 years ago

No worries