Coder Social home page Coder Social logo

Comments (11)

vincss avatar vincss commented on June 27, 2024 1

@iwa , can you put that in the readme ? :-D

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Short update, I tried it out, this was the result with me testing it out:

2022-01-19 04:23:05 info: ................................
2022-01-19 04:23:05 info: ... A new story begin v1.1.3 ...
2022-01-19 04:23:05 info: ................................
2022-01-19 04:23:05 error: Failed to load setting, using default.
2022-01-19 04:23:05 info: Retrieved settings:{"serverName":"SleepingServer, waiting for his prince...","serverPort":25565,"bedrockPort":19132,"maxPlayers":20,"loginMessage":"...Waking server up, come back in a minute...","serverOnlineMode":true,"webPort":0,"startMinecraft":1,"minecraftCommand":"java -jar spigot.jar nogui"}
2022-01-19 04:23:06 info: [McJava] Waiting for a Prince to come. [25565] Or someone to type quit.
2022-01-19 04:23:06 info: [McJava] Ready for battle
2022-01-19 04:23:06 info: [BedRock] Listening on 0.0.0.0:19132
2022-01-19 04:25:20 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:25:29 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:26:16 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:26:16 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:26:16 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:26:33 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:27:00 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:27:03 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:27:05 info: Prince [CENSORED.play] has come, time to wake up.
2022-01-19 04:27:05 info: Sending best regards ...Waking server up, come back in a minute...
2022-01-19 04:27:06 info: [CENSORED] The prince is gone, for now
2022-01-19 04:27:06 info: Cleaning up the place.
2022-01-19 04:27:06 info: [McJava] Closing
2022-01-19 04:27:06 info: [McJava] Closed
2022-01-19 04:27:06 info: [BedRock] Closing
2022-01-19 04:27:06 info: [BedRock] Socket Closed
2022-01-19 04:27:06 info: ----------- Starting Minecraft : java -jar spigot.jar nogui -----------
Error: Unable to access jarfile spigot.jar
2022-01-19 04:27:06 warn: Caught uncaughtException: {"status":1,"signal":null,"output":[null,null,null],"pid":4670,"stdout":null,"stderr":null}
2022-01-19 04:27:06 error: Something bad happened
2022-01-19 04:27:06 info: ...Exiting...

It appears to have issues loading up the settings file, most likely due to not understanding the startCommand: ./home/pmcserver/pmcserver start

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Update #2: I made a few changes to the settings file, I added a minecraftworkingDirectory and changed the startCommand, this time it did not fail to load, however it seems to have failed to launch the server. I'll post both the logs and the settings file below.

Log #2:

2022-01-19 04:34:38 info: ................................
2022-01-19 04:34:38 info: ... A new story begin v1.1.3 ...
2022-01-19 04:34:38 info: ................................
2022-01-19 04:34:38 info: Retrieved settings:{"serverName":"Test Server [Sleeping...]","serverPort":25565,"bedrockPort":19132,"maxPlayers":30,"loginMessage":"...Waking server up, come back in a minute...","serverOnlineMode":true,"webPort":0,"startMinecraft":1,"minecraftCommand":"./pmcserver start","version":"1.18.1","minecraftWorkingDirectory":"/home/pmcserver"}
2022-01-19 04:34:38 info: [McJava] Waiting for a Prince to come. [25565] Or someone to type quit.
2022-01-19 04:34:38 info: [McJava] Ready for battle
2022-01-19 04:34:38 info: [BedRock] Listening on 0.0.0.0:19132
2022-01-19 04:34:48 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:35:48 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:35:49 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:35:52 info: Prince [RinArmani.play] has come, time to wake up.
2022-01-19 04:35:52 info: Sending best regards ...Waking server up, come back in a minute...
2022-01-19 04:35:52 info: [RinArmani] The prince is gone, for now
2022-01-19 04:35:52 info: Cleaning up the place.
2022-01-19 04:35:52 info: [McJava] Closing
2022-01-19 04:35:52 info: [McJava] Closed
2022-01-19 04:35:52 info: [BedRock] Closing
2022-01-19 04:35:52 info: [BedRock] Socket Closed
2022-01-19 04:35:52 info: ----------- Starting Minecraft : ./pmcserver start -----------
[  OK  ] Starting pmcserver: Welcome to my test server
2022-01-19 04:35:56 info: ----------- Minecraft stopped -----------
2022-01-19 04:35:56 info: ...Time to kill me if you want...
2022-01-19 04:36:06 info: ...Too late !...
2022-01-19 04:36:06 info: [McJava] Waiting for a Prince to come. [25565] Or someone to type quit.
2022-01-19 04:36:06 info: [McJava] Ready for battle
2022-01-19 04:36:06 info: [BedRock] Listening on 0.0.0.0:19132
2022-01-19 04:36:07 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:36:10 info: Prince [RinArmani.play] has come, time to wake up.
2022-01-19 04:36:10 info: Sending best regards ...Waking server up, come back in a minute...
2022-01-19 04:36:10 info: [RinArmani] The prince is gone, for now
2022-01-19 04:36:10 info: Cleaning up the place.
2022-01-19 04:36:10 info: [McJava] Closing
2022-01-19 04:36:10 info: [McJava] Closed
2022-01-19 04:36:10 info: [BedRock] Closing
2022-01-19 04:36:10 info: [BedRock] Socket Closed
2022-01-19 04:36:10 info: ----------- Starting Minecraft : ./pmcserver start -----------
[  OK  ] Starting pmcserver: Welcome to my test server
2022-01-19 04:36:15 info: ----------- Minecraft stopped -----------
2022-01-19 04:36:15 info: ...Time to kill me if you want...
2022-01-19 04:36:25 info: ...Too late !...
2022-01-19 04:36:25 info: [McJava] Waiting for a Prince to come. [25565] Or someone to type quit.
2022-01-19 04:36:25 info: [McJava] Ready for battle
2022-01-19 04:36:25 info: [BedRock] Listening on 0.0.0.0:19132
2022-01-19 04:36:29 info: A Prince has taken a quick peek. [handshaking_1.18]
Chunk size is 67 but only 3 was read ; partial packet : {"name":"legacy_server_list_ping","params":{"payload":1}}; buffer :fe0101fa000b004d0043007c00500069006e00670048006f0073007400257f000f003100340037002e003100380035002e003200320031002e0031003900340000c3f0
2022-01-19 04:36:37 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:36:39 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:36:40 info: A Prince has taken a quick peek. [handshaking_1.18]
2022-01-19 04:36:43 info: Prince [Manic137.play] has come, time to wake up.
2022-01-19 04:36:43 info: Sending best regards ...Waking server up, come back in a minute...
2022-01-19 04:36:43 info: [Manic137] The prince is gone, for now
2022-01-19 04:36:43 info: Cleaning up the place.
2022-01-19 04:36:43 info: [McJava] Closing
2022-01-19 04:36:43 info: [McJava] Closed
2022-01-19 04:36:43 info: [BedRock] Closing
2022-01-19 04:36:43 info: [BedRock] Socket Closed
2022-01-19 04:36:43 info: ----------- Starting Minecraft : ./pmcserver start -----------
[  OK  ] Starting pmcserver: Welcome to my test server
2022-01-19 04:36:48 info: ----------- Minecraft stopped -----------
2022-01-19 04:36:48 info: ...Time to kill me if you want...
2022-01-19 04:36:58 info: ...Too late !...
2022-01-19 04:36:58 info: [McJava] Waiting for a Prince to come. [25565] Or someone to type quit.
2022-01-19 04:36:58 info: [McJava] Ready for battle
2022-01-19 04:36:58 info: [BedRock] Listening on 0.0.0.0:19132

Settings file:

serverName: Test Server [Sleeping...]
version: 1.18.1
serverPort: 25565
bedrockPort: 19132
maxPlayers: 30
loginMessage: ...Waking server up, come back in a minute...
serverOnlineMode: true
webPort: 0
startMinecraft: 1
minecraftWorkingDirectory: /home/pmcserver
minecraftCommand: ./pmcserver start

Hope someone can help me, I suspect it won't work tho

from mcsleepingserverstarter.

vincss avatar vincss commented on June 27, 2024

Hi !
I've made another project to support linux-gsm app, I made it mainly for valheim but you can give it a try (it only wakes trought an web interface) :
https://github.com/vincss/sleeping-linux-gsm

The issue there is that SleepingServerStarter launch the command start and wait for it to end, but there your command with lgsm start a background process and return just after.
You would have to make a command to start and wait to the process to end.

Maybe do something like this :
./pmcserver start && while [ "$( ss -tuplwn | grep java ) -gt 0" ] ; do echo ... Server is running ... ; sleep 5 ; done;

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Hi ! I've made another project to support linux-gsm app, I made it mainly for valheim but you can give it a try (it only wakes trought an web interface) : https://github.com/vincss/sleeping-linux-gsm

The issue there is that SleepingServerStarter launch the command start and wait for it to end, but there your command with lgsm start a background process and return just after. You would have to make a command to start and wait to the process to end.

Maybe do something like this : ./pmcserver start && while [ "$( ss -tuplwn | grep java ) -gt 0" ] ; do echo ... Server is running ... ; sleep 5 ; done;

I have seen that, but I didn't like that it required a webserver, prefer if it was automated as I could be asleep. Thank you for the help, I'll try it soon and post an update on the issue

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Hi ! I've made another project to support linux-gsm app, I made it mainly for valheim but you can give it a try (it only wakes trought an web interface) : https://github.com/vincss/sleeping-linux-gsm

The issue there is that SleepingServerStarter launch the command start and wait for it to end, but there your command with lgsm start a background process and return just after. You would have to make a command to start and wait to the process to end.

Maybe do something like this : ./pmcserver start && while [ "$( ss -tuplwn | grep java ) -gt 0" ] ; do echo ... Server is running ... ; sleep 5 ; done;

Update #3: No need for codes here or anything, yours worked perfectly as the replacement "startCommand", thank you. <3

from mcsleepingserverstarter.

vincss avatar vincss commented on June 27, 2024

@Manic137 :
"Update #1: I have tested the server myself to diagnose what the actual problem actually is. It turns out that after the server wakes itself up from being offline through mcsleepingserverstarter and then turns off through EmptyServerStopper, the mcsleepingserverstarter doesn't realize this and still thinks the server is online. The script was still outputting "... Server is running ..." over and over despite the server being offline."

It's more related to the command up there, it's likely that you have another process that responds to the command :
ss -tuplwn | grep java
You will have to debug it , and adapt the command with something more specific to your system.
It's not really related to SSS.

from mcsleepingserverstarter.

vincss avatar vincss commented on June 27, 2024

Maybe try with this command :
./pmcserver start && sleep 30 && while [ "$(ss -tuplwn | grep java)" ] ; do echo ... Server is running ... ; sleep 5 ; done;

After the server start, it will wait for 30 seconds for the server to be up. (It may need to be adapted depending on your server configuration.)

It's highly related to a specific usage you are making of the software.

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Maybe try with this command : ./pmcserver start && sleep 30 && while [ "$(ss -tuplwn | grep java)" ] ; do echo ... Server is running ... ; sleep 5 ; done;

After the server start, it will wait for 30 seconds for the server to be up. (It may need to be adapted depending on your server configuration.)

It's highly related to a specific usage you are making of the software.

I'll give it a shot some time today or tomorrow and update you, Thank you!

from mcsleepingserverstarter.

ManicQuinn avatar ManicQuinn commented on June 27, 2024

Maybe try with this command : ./pmcserver start && sleep 30 && while [ "$(ss -tuplwn | grep java)" ] ; do echo ... Server is running ... ; sleep 5 ; done;

After the server start, it will wait for 30 seconds for the server to be up. (It may need to be adapted depending on your server configuration.)

It's highly related to a specific usage you are making of the software.

Seems to work perfectly, thank you so much :D

from mcsleepingserverstarter.

OneWeekNotice avatar OneWeekNotice commented on June 27, 2024

Apologies @vincss for commenting on this thread./ tagging you. Unsure of proper Github etiquette. Didn't know if I should create a new issue/ where to ask this question. Decided on commenting on this thread since it had the solution to my problem. (will explain below)

Thank you in advance for creating this project and any support. It saves a lot of my server resources and power consumption and it is appreciated.

Main Question:

Just like restartDelay : Customize the delay between when the minecraft server **_stops_** and the sleeping server restarts ( to ensure conection are closed ) ( in milliseconds )

Would it be a valid enchantments use case for the minecraftCommand to add a startDelay: Customize the delay between the minecraft server starts/minecraftCommand and the sleeping server checks the status?

Only reason I ask is because I had a similar problem with a minecraft server management tooling and this solved my issue.

Use Case

I use MinecraftServerControl for management of my Minecraft servers. Following the documentation I added minecraftCommand to my sleepingSettings.yml with the following command to start my Minecraft server mscs start <world>. This command will use the MinecraftServerControl CLI tool to start my server. In this case is a Forge Server

mcsleepingserverstarter was resetting itself. most likely as explained in this issue. the tool would start a background process and return just after.

Some Logs

[v1.9.1] Starting Minecraft : mscs start <world>
[v1.9.1] Minecraft stopped
[Container] ...Time to kill me if you want (5 secs)

Solution

Taken from this thread:

minecraftCommand: mscs start <world> && sleep 300 && while [ "$(ss -tuplwn | grep java)" ] ; do echo ... Server is running ... ; sleep 5 ; done;

Second Question:

for this use case, would it be recommended to use the other tooling that was linked here? https://github.com/vincss/sleeping-linux-gsm

from mcsleepingserverstarter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.