SmartRestart
SmartRestart
The amount of memory remaining before an automatic restart occurs can be customized. You can also configure the number of seconds between checking the amount of memory, as well as the messages displayed before and after the restart.
Official Website: MC.Candy-Sky.Net
The Current Features
- Adjust the amount of memory before an automatic restart
- Configure the amount of seconds between checking the server's memory
- Customize the text to display before the restart occurs
- Customize the text to display after the restart
Commands and Permissions
Permissions is "smartrestart.sr"
- /sr
- Display the free memory ,least free memory and check interval.
- /sr reload
- Reloadd the config.
- /sr restart
- Forced to restart the server.
Example the Config
# Designing by Taiwanese from Candy-sky.net # Check the time in seconds interval check-mem-time: 5 # Restart at least how much memory? free-mem: 100 # Restart messages closeinga-message: "Server out of memory! Restarting to ensure server stability. Do not shut down the server manually." closeingb-message: "Server shutting down in 10 seconds, log out now!" # message to display to kicked players restart-message: "Please wait 30 seconds before logging in to ensure system stability"
Example the Command start.bat for Windows
@ECHO OFF :restart echo run server now , you can't close java -Xmx1024M -Xms1024M -jar craftbukkit.jar echo Restart after 5 seconds , you can close now ping -n 2 -w 500 0.0.0.1>nul echo Restart after 4 seconds , you can close now ping -n 2 -w 500 0.0.0.1>nul echo Restart after 3 seconds , you can close now ping -n 2 -w 500 0.0.0.1>nul echo Restart after 2 seconds , you can close now ping -n 2 -w 500 0.0.0.1>nul echo Restart after 1 seconds , you can close now ping -n 2 -w 500 0.0.0.1>nul goto restart
Example the Shell Script start.sh for Linux
#!/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
Example the Shell Script start.sh for MAC
Theoretical writing Not been tested
#!/bin/bash cd "$( dirname "$0" )" while : ; do echo "run server now , you can't close" java -Xms1024M -Xmx1024M -jar craftbukkit.jar -o true 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
Changelog
- Version 0.4:
- Optimize detection and restart the code again.
- Fix "/sr reload" check interval constant error
- Version 0.3:
- Optimize detection and restart the code.
- Add "/sr" command to display the free memory ,least free memory and check interval.
- Add "/sr reload" to reloadd the config.
- Add "/sr restart" forced to restart the server.
- Version 0.2:
- Correct English syntax errors
- Automatically restart automatically displays the remaining memory to facilitate record
- Version 0.1:
- Initial release
@kgame
it works fine, and the problem only happens on linux servers. hope this helps fix the problem!
Also could you add an option to restart every X hours? something like SimpleRestart. Would be great to have it all in one plugin!
@drdeft
I have the exact same problem!
Btw, where do I put the start.sh file?
@drdeft
Don't worry about it. I think it's still work fine.
No. It doesn't helps.
Here is my config.yml. There are no not-english symbols:
check-mem-time: 5
free-mem: 100
closeinga-message: "11111111"
closeingb-message: "22222222"
restart-message: "33333333"
@drdeft
plugins/SmartRestart/config.yml
@drdeft: Go The original config message is Zh-TW. Please translate to your local language.
What files and how must I translate?
@drdeft
The original config message is Zh-TW.
Please translate to your local language.
1.3.2 bukkit smartrestart 0.4
2012-09-12 11:31:25 [INFO] [SmartRestart] Enabling SmartRestart v0.4 2012-09-12 11:31:25 [SEVERE] Cannot load configuration from stream org.bukkit.configuration.InvalidConfigurationException: unacceptable character '�' (0xFFFD) special characters are not allowed in "<string>", position 46 at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:138) at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:202) at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:121) at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:111) at tw.candy.SmartRestart.SmartRestart.loadConfiguration(SmartRestart.java:81) at tw.candy.SmartRestart.SmartRestart.onEnable(SmartRestart.java:32) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:368) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:383) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:374) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:356) at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:306) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:285) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225) at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:168) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:388) at net.minecraft.server.ThreadServerApplication.run(SourceFile:539) Caused by: unacceptable character '�' (0xFFFD) special characters are not allowed in "<string>", position 46 at org.yaml.snakeyaml.reader.StreamReader.checkPrintable(StreamReader.java:69) at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:49) at org.yaml.snakeyaml.Yaml.load(Yaml.java:399) at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:53) ... 17 more 2012-09-12 11:31:25 [INFO] [SmartRestart] Design in Taiwan By Candy-sky.net 2012-09-12 11:31:25 [INFO] [SmartRestart] 來自台灣人的設計 Candy-sky.net 2012-09-12 11:31:25 [INFO] [SmartRestart] If memory is less than 256 MB, then it will restart automatically. 2012-09-12 11:31:25 [INFO] [SmartRestart] 如果剩下 256 MB 記憶體將會執行重新啟動。 2012-09-12 11:31:25 [INFO] [SmartRestart] Tested once every 5 seconds. 2012-09-12 11:31:25 [INFO] [SmartRestart] 每5秒檢測一次 2012-09-12 11:31:25 [INFO] SmartRestart Enabled
config.yml
check-mem-time: 5 free-mem: 256 closeinga-message: "" closeingb-message: "" restart-message: ""
@candy820522
Silly Cadny.
That is "GC". Not "CG"
@joehot200
抱歉...以下內容太困難,無法為您翻譯...
那可能就是你的啟動參數沒設定好, 你的Java不斷地執行CG, 使記憶體不斷被壓縮, 導致無法觸發SR運作重啟, 要讓SR在JAVA執行CG之前重啟。
ok, this plugin is totally awsome. would it be possible to be able to restart the server when server is taking up so much CPU? my server keeps taking up 170% of its cpu after time, and i would like it to auto-restart
@AssRealm this is cos the restart script is in a loop. go in your console and press control+C or close it (depending on operating system, gui.,etc)
@darkevilmac 幫忙測試一下是否可行
Test feasibility of
@np98765
Thank for the context.
@AssRealm
I'll support /stop to stop in next version.
@np98765
When i use
@ECHO OFF
:restart
java -Xmx1024M -Xms1024M -jar craftbukkit.jar
goto restart
as the start bat, i cant /stop the server. How can i make it so that
when i type /sr restart it restarts and /stop to stop it? When i type
./stop, it restarts. o.o
Would anyone be able to give me a linux startup.sh?
@nic991004
在bat檔裡注意一下,
有利用標記和goto達到循環讓伺服重啟的功能。
基本上所有自動重啟的插件都需要在bat 檔加入
:[標記]
...
...
goto [標記]
是說假如伺服自動關閉後,那還會自動重起嗎?我關閉後就無法"自動"重啟了
The Current Features
Here's a description, if you'd like to use it :)
The amount of memory remaining before an automatic restart occurs can be customized. You can also configure the number of seconds between checking the amount of memory, as well as the messages displayed before and after the restart.
Official Website: MC.Candy-Sky.Net