Jump to content

Auto ReBoot/Restart after crash


Redock

Recommended Posts

Hi.

I need script for auto reboot/restart server after crash or something like that. 

I've found one :

#!/bin/sh
cd /home/minecraft/Kinetic
while true
do
echo "##########STARTING###########"
java -server -Xmx3G -Xms3G -jar forge-1.11.2-13.20.0.2366-universal.jar nogui
echo "Restarting in:"
for i in 5 4 3 2 1
do
echo "$i..."
sleep 1
done
echo "Server Hub Restarting!"
done

But after I trying to start .sh file via terminal I've got an error:

bash: ./start.sh: /bin/bash^M: bad interpreter: No such file or directory

If anyone can help with this I gonna be grateful.

Edited by Redock
Link to comment
Share on other sites

:/home/minecraft/Kinetic# ./reseter.sh
/bin/sh: 0: Can't open cd /home/minecraft/Kinetic \n while true \n do \n echo "##########STARTING###########" \n java -server -Xmx3G -Xms3G

Script:

#!/bin/sh cd /home/minecraft/Kinetic \n while true \n do \n echo "##########STARTING###########" \n java -server -Xmx3G -Xms3G -jar forge-1.11.2-13.20.0.2366-universal.jar nogui \n echo "Restarting in:" for i in 5 4 3 2 1 \n do \n echo "$i..." \n sleep 1 \n done \n echo "Server Hub Restarting!" \n done

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.