I’m trying to make a simple file so I can call it in SSH and it will start my minecraft server.
I tried making a batch file called start.bat with this code:
java -Xmx512M -Xmx512M -jar craftbukkit-1.2.5-R1.0.jar nogui
However, when I run it in SSH:
$ cd /Minecraft/server_1/
$ start.bat
The SSH returns that it is an invalid or unknown command. Is there any other way I can make a quick command/file to start my server? What file extensions would I use to get this working? It works if I paste that java command in SSH and run it, but I’d rather have a file.
The current working directory is not included in your
PATHby default because it is a security risk on multiuser systems. (And a potential annoyance even on machines that are single user.) You would use./start.batto start the program.Since you’re using Windows naming conventions, I presume you also forgot to set the execution mode bit — and you probably also forgot the shebang line at the top of the file.
Try this:
Run
chmod 500on this file. (Strictly speaking,555could also work, if you didn’t mind other people on the machine executing the file. But they don’t need to, so don’t let them.) See thechmod(1)manpage for more details on the modes —1bits mean executable,2bits means writable, and4bits meansreadable— thus,5is executable and readable.Then, when you want to run the script, run it like this:
Note the
./— that means the shell should start the search for the executable program in the current working directory. (It could be./bin/start.batif your current working directory had abinsubdirectory with astart.batexecutable file.)