How do I make a script that restarts a java program every X minutes in Linux?
I will be using:
- PHP
- A linux godaddy hosting account (classic, and I don't know what OS)
- a .sh script
- FTP (to access files)
I am hoping to start a server for minecraft and this is an idea that sounds really cool.
I also need it to be that if I change the script, it restarts and runs the new script instead of the old one. I am hoping to have a php document open the whole time the server is on (If the php document is closed, the server is closed). This should be all in one script/PHP webpage.
Finally, it has to work the first time or I won't be able to stop the program.
I have included a .sh script of what I have so far:
#!/bin/sh
pkill java
screen java -Xmx1024M -jar craftbukkit.jar -o true
Does it work? I need a PHP code to start it up and keep it running while the webpage is loaded.