add a auto restarting shell script with git pull support and change some values

This commit is contained in:
Jordach 2017-11-28 21:05:21 +00:00
parent 3d37a32dfe
commit ef1d2c3849
3 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,9 @@
#!/bin/bash
while :
do
./minetest --server --gameid Solar_Plains --world world
cd ../games/Solar_Plains && git pull
cd ../../bin
done

View File

@ -12,7 +12,7 @@
-- or by setting enable_auto_shutdown to false
local enable_auto_shutdown = false
local enable_auto_shutdown = true
local is_shutting_down = false
@ -22,6 +22,8 @@ local players_joined = 0
local shutdown_delay = 60
local auto_check_delay = 120
local shutdown_message = "Server is shutting down to re-generate player hands and perform maintenance. Thank you for your patience."
-- register chat commands
@ -101,7 +103,7 @@ local function check_for_players()
end
minetest.after(15, check_for_players)
minetest.after(auto_check_delay, check_for_players)
end
minetest.register_on_joinplayer(function(player)
@ -118,4 +120,4 @@ minetest.register_on_leaveplayer(function(player)
end)
minetest.after(15, check_for_players)
minetest.after(auto_check_delay, check_for_players)

View File

@ -0,0 +1,13 @@
auto-start.sh must be placed into your Minetest's /bin/ directory if it's running in it's own folder, and *only* it's own folder.
Replace Solar_Plains with any other subgame and ensure that it updates with git - otherwise, just remove && git pull .
This shell script must be run exactly like this, and preferably under screen ot tmux or similar. But please not as root via sudo or sudo su.
. auto-start.sh
Otherwise, it will fail to change directories and git pull.
Extra notes, this script was built in mind with auto_maintainence in mind.
Shits WTFPL. Go ham - I really don't care.