Problem Problem with ServerStart.sh

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord
S

SmotPokin42000

Guest
The start script included with the Infinity server pack isn't working for me.
Code:
root@Rising-Mergical-Server:/home/Root/RisingSunFTB# sh ServerStart.sh
ServerStart.sh: line 2: $'\r': command not found
: No such file or directory .
ServerStart.sh: line 4: $'\r': command not found
ServerStart.sh: line 5: $'\r': command not found
ServerStart.sh: line 12: syntax error near unexpected token `$'{\r''
'erverStart.sh: line 12: `eula_false() {
root@Rising-Mergical-Server:/home/Root/RisingSunFTB#
I'm running Ubuntu Server 14.04 LTS
 

jikuja

legacy FTB Launcher developer
Launcher Developer
Global Moderator
Dec 17, 2013
1,134
111
99
Version of the infinity? Where did you download server files?
 

slackernet

New Member
Jul 29, 2019
7
0
0
I noticed you are running as root....not usually a good thing serverstart.sh and its directory should be assigned to a user who would be ssh into the box

open the eula and change it from false to true and save it using a text editor like nano

try and run ./serverstart.sh to see if it works
 
S

SmotPokin42000

Guest
I downloaded the server zip from the FTB launcher. Its infinity version 2.2.2, forge version 1558.

I'm running it as root because I can't be bothered to setup proper accounts. Also, each account needs to have access to its own directory, with some accounts having access to the same directory, but with different permissions. I don't know how to set it up like that... yet.

Changing the eula.txt was one of the first things I did before attempting to start it. This isn't my first server, its also not my first modded server either.
Code:
#By changing the setting below to TRUE you are indicating your agreement to our$
#Mon Sep 29 23:27:36 UTC 2014
eula=true

I know it says this above: 'erverStart.sh: line 12: `eula_false() { Thats nothing but output from the useless script.


It isn't named serverstart.sh, so naturally, that wont work.
Code:
root@Rising-Mergical-Server:/home/Root/RisingSunFTB# sh ./serverstart.sh
sh: ./serverstart.sh: No such file or directory
root@Rising-Mergical-Server:/home/Root/RisingSunFTB# ls
config                 FTBServer-1.7.10-1558.jar    server-icon.png
eula.txt               libraries                    server.properties
FTBInfinityServer.zip  minecraft_server.1.7.10.jar  ServerStart.bat
FTBInstall.bat         modpack                      ServerStart.sh
FTBInstall.sh          mods                         version.json
root@Rising-Mergical-Server:/home/Root/RisingSunFTB#

Normally, I run my servers using a command like this:
java -Xms512M -Xmx12G -XX:MaxPermSize=128M -jar FTBServer-1.7.10-1558.jar nogui
But, that doesn't work either.
 
Last edited:

jikuja

legacy FTB Launcher developer
Launcher Developer
Global Moderator
Dec 17, 2013
1,134
111
99
Works for me. Are you sure your FTP or something else did not change line endings?
 

slackernet

New Member
Jul 29, 2019
7
0
0
your ls command says it is named SereverStart.sh above ?

well anyway did you make the .sh file executable ?

chmod a+x ServerStart.sh

the text name of the file usually turns green in color if it is executable. usually another ls or ls -l command is need to confirm

the difference between chmod a+x vs chmod 775

Paste:

chmod a+x will add the exec bits to the file but will not touch other bits. For example file might be still unreadable to others and group.

chmod 755 will always make the file with perms 755 no matter what initial permissions were.

This may or may not matter for your script.

here is the contents of my ServerStart.sh file

Code:
if [ ! -f minecraft_server.1.7.10.jar ]; then
  echo "running install script!"
  ./FTBInstall.sh
fi
echo "make sure to read eula.txt before playing!"
java -server -Xms2048m -Xmx3072m -XX:PermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -jar FTBServer-1.7.10-1231.jar nogui


PS: one final thought...... the root home dir may be protected.....
/home/Root/RisingSunFTB#

make a public folder in the root dir with 775 or 777 access..move the server files there and try it again.... its just a thought
 
Last edited:

jikuja

legacy FTB Launcher developer
Launcher Developer
Global Moderator
Dec 17, 2013
1,134
111
99
Script files don't need executable bits if script is called as command interpreter argument(e.g.
"sh ServerStart.sh" in OP's message)...
 

cazzar

New Member
Jul 29, 2019
1
0
0
The problem there, is the line endings as was initially hinted to as by jikuja, how to fix this itself can be done in one of many ways, (my personal favourite is the command dos2unix filea) though, some other ways are highlighted here

Though, do note that linux is CASE SENSITIVE so, if your file is called ./ServerStart.sh running ./serverstart.sh will be looking for another file.
 
S

SmotPokin42000

Guest
I don't know how the FTP client/server could have changed the line endings on this, as I had uploaded the whole zip file and extracted the server files using the unzip command. I had uploaded an older version of infinity that was pre-extracted and had the exact same issue running the ServerStart.sh script, so I deleted it and uploaded the newer zip file. I could have the server download the zip file directly, though I doubt it would change anything.

I included the contents of the start script using gedit:
Code:
#!/bin/sh

cd "$(dirname "$0")"


# makes things easier if script needs debugging
if [ x$FTB_VERBOSE = xyes ]; then
    set -x
fi

# cleaner code
eula_false() {
    grep -q 'eula=false' eula.txt
    return $?
}



# run install script if MC server or launchwrapper s missing
if [ ! -f minecraft_server.1.7.10.jar ]; then
    echo "Missing required jars. Running install script!"
    sh ./FTBInstall.sh
fi

# check if there is eula.txt and if it has correct content
if [ -f eula.txt ] && eula_false ; then
    echo "Make sure to read eula.txt before playing!"
    echo "To exit press <enter>"
    read ignored
    exit
fi

# inform user if eula.txt not found
if [ ! -f eula.txt ]; then
    echo "Missing eula.txt. Startup will fail and eula.txt will be created"
    echo "Make sure to read eula.txt before playing!"
    echo "To continue press <enter>"
    read ignored
fi

echo "Starting server"
java -server -Xms512m -Xmx2048M -XX:PermSize=256m -d64 -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1558.jar nogui
echo "Server process finished"

Everything in the server's home folder, along with the folder it self, is set to 777. I'm certain that this has nothing to do with permissions.

I'll try using the start command from the script.
 
S

SmotPokin42000

Guest
The command works but I'd still like to know what the problem is with this script so I can setup auto restarts.
 

jikuja

legacy FTB Launcher developer
Launcher Developer
Global Moderator
Dec 17, 2013
1,134
111
99
Infinity 2.2.2 is not shipped with new scripts which adds support for ftb-utilities' autorestart feature.