Jump to content

Recommended Posts

Posted

I've been searching for a plugin to restart my server every X hours. So far I've found this little plugin http://dev.bukkit.org/server-mods/smart-restart/files/- it was the only one with 1.2.5.

The problem is I'm semi-retarded when it comes to Linux, I only know the basic commands to get around. The guy who built the plugin has a script there:

#!/bin/sh

BINDIR=$(dirname "$(readlink -fn "$0")")

cd "$BINDIR"

while : ; do

echo "run server now , you can't close"

java -Xmx1024M -Xms1024M -jar craftbukkit.jar

echo "Restart after 5 seconds , you can close now"

sleep 1

echo "Restart after 4 seconds , you can close now"

sleep 1

echo "Restart after 3 seconds , you can close now"

sleep 1

echo "Restart after 2 seconds , you can close now"

sleep 1

echo "Restart after 1 seconds , you can close now"

sleep 1

done

made for Linux users. The problem is I have no idea how to set it up

properly.

I'm using Ubuntu 12.10 with Screen installed.

Can anybody explain to me like I'm 5 how to properly setup this script?

Posted

crontab -e



 

* */12 * * * /path/to/your/script/here (this would run every 12th hour)

 

CTRL+O

CTRL+X

 

I'm not the greatest with scripting, but, it looks like that thing will not hop on your Screen. Try to inject with:

 


screen -x SCREENNAMEHERE -X stuff "say Restarting in 1 minute for daily maintenance. $(echo -ne '\r')"

sleep 60

screen -x SCREENNAMEHERE -X stuff "say Restarting for daily maintenance. $(echo -ne '\r')"

sleep 1

screen -x SCREENNAMEHERE -X stuff "save-all $(echo -ne '\r')"

sleep 5

screen -x SCREENNAMEHERE -X stuff "stop $(echo -ne '\r')"

sleep 10

mv server.log /backup/log/location/here

screen -x SCREENNAMEHERE -X stuff "java -whatever Tekkit.jar $(echo -ne '\r')"

exit

Also, you need to "chmod +x yourscript" so it can be executed.

You can also set a variable for the screen name, paths, and time stamps for your server logs if you chose. That's a rough script but it will get you started. Read the man on Screen if you want to learn about anything else.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...