c3pu Posted January 29, 2017 Share Posted January 29, 2017 How would I implement the new save() and stop() functions to make a server restart script? I have tried running something like: now = os.time() then = now + 3600 while if (os.time >= then) then save() Server():broadcastChatMessage("Server", 0, "--Restarting Server--") stop() end end Help would be greatly appreciated :) Link to comment Share on other sites More sharing options...
Tarantel Posted January 29, 2017 Share Posted January 29, 2017 How would I implement the new save() and stop() functions to make a server restart script? I have tried running something like: now = os.time() then = now + 3600 while if (os.time >= then) then save() Server():broadcastChatMessage("Server", 0, "--Restarting Server--") stop() end end Help would be greatly appreciated :) Linux or Windows ? Link to comment Share on other sites More sharing options...
c3pu Posted January 29, 2017 Author Share Posted January 29, 2017 Windows, but the OS shouldn't matter since I have already wrapped the server. So I only need to find a way to stop it, my batch file will do the restart. Link to comment Share on other sites More sharing options...
Aki Posted January 29, 2017 Share Posted January 29, 2017 First issue I see is: then = now + 3600 You can't use then as identifier. You could use os.execute([command]) to use external commands as far as I tested - it works. But putting server restarting script into the server itself is a bad design. There are tools that allows you to schedule tasks on most OSes. Using external scripts to manage server is easier to use and to configure, is more secure and more fault proof. Link to comment Share on other sites More sharing options...
c3pu Posted January 29, 2017 Author Share Posted January 29, 2017 First issue I see is: then = now + 3600 You can't use then as identifier. You could use os.execute([command]) to use external commands as far as I tested - it works. But putting server restarting script into the server itself is a bad design. There are tools that allows you to schedule tasks on most OSes. Using external scripts to manage server is easier to use and to configure, is more secure and more fault proof. Ok thanks, this was just pseudo code, I have never actually coded in LUA. I'll try doing something when the Server Launcher works later on. Link to comment Share on other sites More sharing options...
Kane Hart Posted January 31, 2017 Share Posted January 31, 2017 Has anyone made a fully functional script to say reboot the server using /stop every say 3-6 hours with an announcement maybe 15 10 5 and then 4 3 2 1 and then 30 seconds and down countdown? Not much of a scripter myself so hoping someone has something for this. Link to comment Share on other sites More sharing options...
Aki Posted January 31, 2017 Share Posted January 31, 2017 As far as I remember you use nix, so: http://www.avorion.net/forum/index.php/topic,642.0.html with cron: 0 0,6,12,18 * * * avorion <path>/manager restart 55 23,5,11,17 * * * avorion <path>/manager warning 5 50 23,5,11,17 * * * avorion <path>/manager warning 10 45 23,5,11,17 * * * avorion <path>/manager warning 15 Or similar. You could also probably adjust your own script for that. Link to comment Share on other sites More sharing options...
Kane Hart Posted January 31, 2017 Share Posted January 31, 2017 Ahh I see. I was just using my own reboot sh script and was hoping for a simple lua stop script with messages but maybe that is not as easy. I'm not a fan doing cron jobs I always like doing all built into a script. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now