steves-underwater-paradise / restart-server

Minecraft Fabric mod that adds a restart command to dedicated servers.
https://www.curseforge.com/minecraft/mc-mods/restart-server
GNU Lesser General Public License v2.1
6 stars 2 forks source link

Relative Path To Script #5

Closed Brittank88 closed 1 year ago

Brittank88 commented 1 year ago

I have a Start.sh file in the root of my server installation that I wish to point to. Unfortunately, it is not specified what the 'origin' of the start script path you specify is. I've tried Start.sh and ../Start.sh to no avail.

Steveplays28 commented 1 year ago

It's supposed to be a relative path to the server.jar directory iirc, or the directory the server is started in. Let me test on my end to see which is the case and if ../start.sh works.

Steveplays28 commented 1 year ago

You seem to be right, it only looks in the server's run directory. I'll add this to my list of issues for #4, and get this fixed for the next release. For now, you'll have to place the script in the same directory as the server.

[13:50:34] [Server thread/INFO]: [Restart Server] java.io.IOException: Cannot run program "cmd /c ..\start.bat" (in directory "C:\Misc\Minecraft Quilt 1.19.2 test server\server"): CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
        at io.github.steveplays28.restartserver.commands.RestartCommand.execute(RestartCommand.java:40)
        at io.github.steveplays28.restartserver.commands.RestartCommand.lambda$register$0(RestartCommand.java:20)
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:263)
        at net.minecraft.class_2170.method_9249(class_2170.java:271)
        at net.minecraft.class_2170.method_44252(class_2170.java:264)
        at net.minecraft.class_3176.method_13941(class_3176.java:305)
        at net.minecraft.class_3176.method_3813(class_3176.java:290)
        at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:819)
        at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:665)
        at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
        ... 12 more

[13:50:34] [Server thread/INFO]: [Restart Server] Server restart failed.
Brittank88 commented 1 year ago

My confusion is that it is. Start.sh is in the root of the server, alongside the server jarfile, etc.

Steveplays28 commented 1 year ago

Ah, my bad. I misread your original question.

Still though, for me it works if I just set the start script in the config to Start.sh and have this file be in the server root. Can you give me your log files and directory tree of the server?

Brittank88 commented 1 year ago
Full tree (max depth of 2 for conciseness) ``` . ├── 2 │   └── x86_64-linux-gnu ├── banned-ips.json ├── banned-players.json ├── config [60 entries exceeds filelimit, not opening dir] ├── crash-reports │   └── crash-2022-10-30_07.53.03-server.txt ├── dynmap │   ├── colorschemes │   ├── configuration.txt │   ├── custom-lightings.txt │   ├── custom-perspectives.txt │   ├── custom-shaders.txt │   ├── export │   ├── fabricworlds.yml │   ├── hiddenplayers.txt │   ├── ids-by-ip.txt │   ├── lightings.txt │   ├── markers │   ├── markers.yml │   ├── permissions.yml.example │   ├── perspectives.txt │   ├── renderdata │   ├── shaders.txt │   ├── templates │   ├── texturepacks │   ├── version.txt │   ├── web │   ├── world.pending │   └── worlds.txt ├── eula.txt ├── global_packs │   ├── optional_data │   └── required_data ├── journeymap │   └── server ├── libraries │   ├── com │   ├── commons-io │   ├── io │   ├── it │   ├── net │   └── org ├── logs │   ├── 2022-10-30-1.log.gz │   ├── 2022-10-30-2.log.gz │   ├── 2022-10-30-3.log.gz │   ├── 2022-10-30-4.log.gz │   ├── 2022-10-30-5.log.gz │   ├── 2022-10-30-6.log.gz │   ├── 2022-10-30-7.log.gz │   ├── latest.log │   ├── rei-issues.log │   └── rei.log ├── mods [104 entries exceeds filelimit, not opening dir] ├── not-enough-crashes │   ├── mappings-1.19.2.tiny │   └── yarn-version.txt ├── ops.json ├── quilt-installer-latest.jar ├── quilt-server-launcher.properties ├── quilt-server-launch.jar ├── resourcepacks ├── server.jar ├── server.properties ├── Start.sh ├── usercache.json ├── versions │   └── 1.19.2 ├── whitelist.json └── world ├── advancements ├── data ├── datapacks ├── DIM-1 ├── DIM1 ├── entities ├── fabrication ├── ledger.sqlite ├── level.dat ├── level.dat_old ├── playerdata ├── poi ├── region ├── scripts ├── session.lock └── stats ```

latest.log

Steveplays28 commented 1 year ago

Thanks!

So just to verify once more if you don't mind, the error from your log file at line 837 also occurs when Start.sh is in the same directory as the server.jar? And your config's restartScript is set to the below?

  "restartScript": "Start.sh",
Brittank88 commented 1 year ago

Yes, that's correct.

Brittank88 commented 1 year ago

Seeing as this could be file I/O related, here's the system specs:

       _,met$$$$$gg.          game-server@Game-Server
    ,g$$$$$$$$$$$$$$$P.       -----------------------
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 11 (bullseye) x86_64
 ,$$P'              `$$$.     Kernel: 5.10.0-18-amd64
',$$P       ,ggs.     `$$b:   Uptime: 7 days, 11 hours, 27 mins
`d$$'     ,$P"'   .    $$$    Packages: 520 (dpkg)
 $$P      d$'     ,    $$P    Shell: fish 3.1.2
 $$:      $$.   -    ,d$$'    Terminal: /dev/pts/0
 $$;      Y$b._   _,d$P'      CPU: Intel i5-7500 (4) @ 3.800GHz
 Y$$.    `.`"Y$$$$P"'         GPU: Intel HD Graphics 630
 `$$b      "-.__              Memory: 160MiB / 7814MiB
  `Y$$
   `Y$$.
     `$$b.
       `Y$$b.
          `"Y$b._
              `"""
Steveplays28 commented 1 year ago

Thanks.

By the way, sorry, my above comment wasn't completely correct, I forgot that in v1.0.0 the restart scripts were still separated by OS, though I removed this in the development branch since there's no point in having that separated. Still an odd bug though. I haven't done any testing on Linux or MacOS, so that's probably why this bug is occurring on your end but not on mine.

I just downloaded v1.0.0 and ran it on a Quilt 1.19.2 server, and it all seems to work (Windows 10): image image

Do you mind contacting me on Discord, if you have the time? Might be a bit easier than back and forth on GitHub. Don't worry if not though.

Brittank88 commented 1 year ago

I've sent you a message on Discord!

Funnily enough, it actually works if I supply the absolute path to the script.

Steveplays28 commented 1 year ago

Interesting. I didn't even know absolute paths worked as well, good to know. I need to make documentation someday lmao