Making a batch file for a server

joce21

Distinguished
May 30, 2010
2
0
18,510
0
Hi the community!!

I host a server Minecraft on a computer with Vista and I must restart my server manually for maintenance. I'm not very good in Batch files and I'm looking for something that would stop and restart my server/computer at a specific time automatically.

The batch file would be like:

"At a specified time, (Example: at 3 am)

Stop the server (Write stop in the cmd (The server window already open)),
Restart the computer,
Start the server (Run my startServer.bat)."

To run my server, I run a Batch file (startServer.bat) with this line :
java -Xms512M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar

Waiting for you responses :p
 

Rusting In Peace

Distinguished
Jul 2, 2009
313
0
19,060
34
You can use the Task Scheduler to run programs of your choice. Programs -> Accessories -> System Tools -> Task Scheduler.

So create two tasks

1) On machine boot run startServer.bat

2) If you don't care that the server wouldn't be shutting down cleanly, you could have a task that restarted that computer at 3am. Doing a restart would obviously shut down the running server.

Stopping the server cleanly will be a little harder because you are running a batch file rather than being in the server console window.
 

joce21

Distinguished
May 30, 2010
2
0
18,510
0
Is there a way to create a file that will automatically send "s-t-o-p" and "enter" to the OS ?

So I can make a task scheduler to call this file at 2:59 and another one task scheduler that start at 3am and reboot my computer?
 

Rusting In Peace

Distinguished
Jul 2, 2009
313
0
19,060
34
You aren't trying to send the stop command to the OS; it's to the java server.

I don't think you need two tasks. You should have one task and one batch file that shuts down the server and then restarts the machine.
 
Thread starter Similar threads Forum Replies Date
B Apps General Discussion 9
G Apps General Discussion 2
P Apps General Discussion 5
R Apps General Discussion 3
M Apps General Discussion 1
J Apps General Discussion 1
R Apps General Discussion 2
iPen Apps General Discussion 2
moulderhere Apps General Discussion 7
U Apps General Discussion 1
F Apps General Discussion 1
T Apps General Discussion 5
J Apps General Discussion 3
T Apps General Discussion 5
Alaispera Apps General Discussion 3
T Apps General Discussion 1
S Apps General Discussion 2
A Apps General Discussion 10
C Apps General Discussion 2
B Apps General Discussion 4

ASK THE COMMUNITY