Request ServerStart.sh After Upgrade

budivudi

New Member
Jul 29, 2019
12
0
0
Hi,

Would it be possible to add something like this to ServerStart.sh

Code:
--- ServerStart.sh.orig 2015-06-23 15:32:46.000000000 +0200
+++ ServerStart.sh  2015-07-31 08:47:10.408960353 +0200
@@ -2,6 +2,7 @@
cd "$(dirname "$0")"
+FTB_DEFS=$1
# makes things easier if script needs debugging
if [ x$FTB_VERBOSE = xyes ]; then
@@ -20,6 +21,7 @@
if [ ! -f minecraft_server.1.7.10.jar ]; then
  echo "Missing required jars. Running install script!"
  sh ./FTBInstall.sh
+  FTB_DEFS=-Dfml.queryResult=confirm
fi
# check if there is eula.txt and if it has correct content
@@ -39,5 +41,5 @@
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-1448.jar nogui
-echo "Server process finished"
\ No newline at end of file
+java -server -Xms512m -Xmx4096M -XX:PermSize=512m -d64 -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar ${FTB_DEFS} FTBServer-1.7.10-1448.jar nogui
+echo "Server process finished"

The idea is when starting the server after an upgrade it runs with -Dfml.queryResult=confirm the first time.

The script I use to upgrade is:
Code:
OLDVER=1.7-1.8.2
NEWVER=1.7-1.9.0
pkill java
cd /usr/local/minecraft/
mv /tmp/FTBInfinityServer.zip FTBInfinityServer-${NEWVER}.zip
mv infinity infinity-${OLDVER}
mkdir infinity
cd infinity
mkdir -p config/JourneyMapServer/
unzip ../FTBInfinityServer-${NEWVER}.zip
/bin/cp -ax ../infinity-${OLDVER}/world .
/bin/cp ../infinity-${OLDVER}/eula.txt .
/bin/cp ../infinity-${OLDVER}/server.properties .
/bin/cp ../infinity-${OLDVER}/config/JourneyMapServer/world.cfg config/JourneyMapServer/
JSON="banned-ips.json banned-players.json ops.json usercache.json version.json whitelist.json"
for i in ${JSON}; do
/bin/cp -v ../infinity-${OLDVER}/$i .
done
/bin/rm *.bat -v
/bin/chmod -v +x *.sh
/bin/mv ServerStart.sh ServerStart.sh.orig
/bin/cp /usr/local/minecraft/infinity-${OLDVER}/ServerStart.sh .
./ServerStart.sh

Thanks
Duncan
 

Inngrimsch

New Member
Jul 29, 2019
246
0
0
a) try it
b) i don't think that it works as the java arguments are already set at the start of the server start and the fml confirm is getting asked after the starting is already underway
c) interesting upgrade script non the less, i still use filezilla to just upload the mod/config folders and if needed be new forge version^^
 

budivudi

New Member
Jul 29, 2019
12
0
0
It works just fine.

The first time the script is run after an upgrade after sh ./FTBInstall.sh is executed is adds -Dfml.queryResult=confirm to the command line to allow missing items to be fixed. After the first time this is not added again and runs normally.

I added this FTB_DEFS=$1 to allow other arguments to be passed in but this is not really necessary and not really my goal.

Cheers,
Duncan
 

Inngrimsch

New Member
Jul 29, 2019
246
0
0
i see that explains why you added the FTB_DEFS variable was confused first why you would add the first argument $1 and also add the set string ^^
also wouldnt it be better to change the first 2 lines
Code:
OLDVER=1.7-1.8.2 -> OLDVER=$1
NEWVER=1.7-1.9.0 -> NEWVER=$2
pkill java
cd /usr/local/minecraft/
mv /tmp/FTBInfinityServer.zip FTBInfinityServer-${NEWVER}.zip
mv infinity infinity-${OLDVER}
mkdir infinity
cd infinity
mkdir -p config/JourneyMapServer/
unzip ../FTBInfinityServer-${NEWVER}.zip
/bin/cp -ax ../infinity-${OLDVER}/world .
/bin/cp ../infinity-${OLDVER}/eula.txt .
/bin/cp ../infinity-${OLDVER}/server.properties .
/bin/cp ../infinity-${OLDVER}/config/JourneyMapServer/world.cfg config/JourneyMapServer/
JSON="banned-ips.json banned-players.json ops.json usercache.json version.json whitelist.json"
for i in ${JSON}; do
/bin/cp -v ../infinity-${OLDVER}/$i .
done
/bin/rm *.bat -v
/bin/chmod -v +x *.sh
/bin/mv ServerStart.sh ServerStart.sh.orig
/bin/cp /usr/local/minecraft/infinity-${OLDVER}/ServerStart.sh .
./ServerStart.sh

so that you dont have to edit the shell script everytime you update?
 

budivudi

New Member
Jul 29, 2019
12
0
0
That's for the upgrade script but it is a good idea. I usually run the lines from this script by hand because of the line "
/bin/cp /usr/local/minecraft/infinity-${OLDVER}/ServerStart.sh ." as the FTBServer-1.7.10-1448.jar file sometimes gets updated between releases. And as the version number is hard-coded on this line it make it difficult to patch. This could be split into two lines line FTBServerJarVersion=1.7.10-1448; and then use it like FTBServer-${FTBServerJarVersion}.jar

You are correct about FTB_DEFS=$1 the line
FTB_DEFS=-Dfml.queryResult=confirm
in this case the line should really have read
FTB_DEFS="${FTB_DEFS} -Dfml.queryResult=confirm"
but this may have been a bad idea.

Cheers,
Duncan
 

jikuja

legacy FTB Launcher developer
Launcher Developer
Global Moderator
Dec 17, 2013
1,134
111
99
I would not add parameters based in missing files because now fml.queryResult=confirm would be turned on for other users without notifications. Imho more correct way to do is to pass environment value from your update script.

Use case: user updates new version, copies old world to new installation, runs ServerStart.sh => queries are automatically confirmed.

Also in first post $FTB_DEFS should be before -jar argument.
 

budivudi

New Member
Jul 29, 2019
12
0
0
Passing an enviroment variable would be just fine, In this case it would still be useful to have a variable like ${FTB_DEFS} in the java line.

To be honest I don't see what option people have except to define fml.queryResult=confirm with a nogui line anything else like cancel and the server does not start doing nothing and it hangs waiting for a confirm or cancel that cannot be typed. All that you find out is that certain items are missing or duplicated but what can we do about these? If all goes wrong there is a complete backup.

I'm sure that you know more than me so maybe it is possible to answer the confirm or cancel question so that the server can start.

Thanks
Duncan