Thread: Trying to get a java program to restart when it crashes
thanks in advance reply.
i'm relatively new linux , trying run minecraft server. got server running fine recent pre-release bit unstable. such, crashes often.
read that there ways ubuntu run called "bashscript" (i'm guessing it's .bin on ***dows) automatically check if program running, , start program if not running. problem can't make heads or tails of code...
can me code out?
figured out
it's more complicated typing text in terminal unfortunately, follow instructions:
fair warning, code depends on server being java app running on computer. won't able use other java app while running -- sorry!
- create document following code (anywhere on machien)
code:#!/bin/bash while true if [ ! `pgrep java` ] ; /usr/bin/minecraft.sh fi sleep 30 done- create document in minecraft server folder , title "start server.sh" following code
code:cd /home/kenji_03/games/minecraftserver java -xms1g -xmx1g -jar minecraft_server.jar- <important> must change "change directory" (cd) portion direct terminal minecraft server folder
- make link "start server.sh"
- copy it
- go /usr/bin root user (you can use terminal's "sudo nautilus" browser gui).
- paste link , rename "minecraft.sh" (case sensitive)
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Trying to get a java program to restart when it crashes
Ubuntu
Comments
Post a Comment