server launch from bat file

spudy12

New Member
Jul 29, 2019
20
0
1
righto, i'm running my server from a batch file. i usually created a shortcut to this in the startup startmenu folder.
I've recently just moved my server to a RAM drive which is working amazingly!
however, if I run this script, it usually runs before the RAM drive has been detected, or it can't find the script.

How do I make a bat file that waits 10 secs (think i've figured this out using ping) then runs the server startup bat file on the RAM drive?

Spud
 

Nessiroj

New Member
Jul 29, 2019
855
0
1
Add the following code at the start of the batchfile (or after @echo off)
Code:
ping 123.45.67.89 -n 1 -w 10000 > nul

Code:
You can ping an address that surely doesn't exist and specify the desired timeout:
 
ping 123.45.67.89 -n 1 -w 10000 > nul
And since the address does not exists, it'll wait 10,000 ms (10 seconds) and returns.
 
The -w 10000 part specifies the desired timeout in milliseconds.
The -n 1 part tells ping that it should only tries once (normally it'd try 4 times).
The > nul part is appended so the ping command doesn't output anything to screen.
You can easily make a sleep command yourself by creating a sleep.bat somewhere in your PATH and use the above technique
 

spudy12

New Member
Jul 29, 2019
20
0
1
Thanks
I'd figured out the ping part. The part I'm struggling with is pointing it to run a .bat file that is on a different drive
how do I do this?
 

Nessiroj

New Member
Jul 29, 2019
855
0
1
Code:
call msbuild.bat
call unit-tests.bat
call deploy.bat
 
Or for example
 
call c:\msbuild.bat
call d:\unit-tests.bat
call e:\deploy.bat
 

spudy12

New Member
Jul 29, 2019
20
0
1
Right, so I have now got it to call the serverstart bat file but nothing happens.
when i put a pause in the script, this is what I see

Code:
C:\Users\Media-Server\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Star
tup>ping -n 11 127.0.0.1  1>nul
 
C:\Users\Media-Server\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Star
tup>call H:\Minecraft\MindCrack\Server-Start.bat
 
C:\Users\Media-Server\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Star
tup>java -Xms2G -Xmx4G -jar mindcrack.jar -server -XX:+AggressiveOpts -XX:UseSSE
=4 -XX:+UseFastAccessorMethods -XX:CMSFullGCsBeforeCompaction=1 -XX:+CMSParallel
RemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseParNewGC -XX:+DisableEx
plicitGC -XX:ParallelGCThreads=4
Error: Unable to access jarfile mindcrack.jar
 
C:\Users\Media-Server\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Star
tup>pause
Press any key to continue . . .
 

Nessiroj

New Member
Jul 29, 2019
855
0
1
something goes wrong with the server-start.bat

Change:
Code:
java -Xms2G -Xmx4G -jar mindcrack.jar -server -XX:+AggressiveOpts -XX:UseSSE
=4 -XX:+UseFastAccessorMethods -XX:CMSFullGCsBeforeCompaction=1 -XX:+CMSParallel
RemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseParNewGC -XX:+DisableEx
plicitGC -XX:ParallelGCThreads=4

to

Code:
java -server -Xms2G -Xmx4G -XX:+AggressiveOpts -XX:UseSSE
=4 -XX:+UseFastAccessorMethods -XX:CMSFullGCsBeforeCompaction=1 -XX:+CMSParallel
RemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseParNewGC -XX:+DisableEx
plicitGC -XX:ParallelGCThreads=4 -jar H:\Minecraft\Mindcrack\mindcrack.jar

and see if that helps, because the jarfile aint in c: so i guess we need to point it directly