• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Auto-run after Server Save

Imereth Popis

dopera.sytes.net
Joined
Jan 30, 2017
Messages
111
Solutions
1
Reaction score
12
Location
Spain
Hello guys. I want to shutdown the server every server save. My serversave's code is this:

Lua:
local shutdownAtServerSave = true
local cleanMapAtServerSave = false

local function serverSave()
   if shutdownAtServerSave then
       Game.setGameState(GAME_STATE_SHUTDOWN)
   else
       Game.setGameState(GAME_STATE_CLOSED)

       if cleanMapAtServerSave then
           cleanMap()
       end

       Game.setGameState(GAME_STATE_NORMAL)
   end
end

local function secondServerSaveWarning()
   broadcastMessage("Server is saving game in one minute. Please logout.", MESSAGE_STATUS_WARNING)
   addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
   broadcastMessage("Server is saving game in 3 minutes. Please logout.", MESSAGE_STATUS_WARNING)
   addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
   broadcastMessage("Server is saving game in 5 minutes. Please logout.", MESSAGE_STATUS_WARNING)
   Game.setGameState(GAME_STATE_STARTUP)
   addEvent(firstServerSaveWarning, 120000)
   return not shutdownAtServerSave
end

I want to auto-run after every server save. Shutting the server down.

Thanks you in advance[/code]
 
You need to use some auto-run scripts that would turn on your ots after every shutdown (auto-restarter)

for linux systems you can use bash script
Code:
#!/bin/bash
ulimit -c unlimited
while true; do ./tfs; done
 
You need to use some auto-run scripts that would turn on your ots after every shutdown (auto-restarter)

for linux systems you can use bash script
Code:
#!/bin/bash
ulimit -c unlimited
while true; do ./tfs; done
how to use it? put the three commands with sudo or put your code inside a file? I am new in linux systems, can you explain me a bit more? thanks
 
put inside file and run the script

there could be need to give new file privileges to execute, in that case you would need to do 'chmod +x filename'

then just run it
 
put inside file and run the script

there could be need to give new file privileges to execute, in that case you would need to do 'chmod +x filename'

then just run it
okay, last question, which type of file and what location I put it?, thanks again...
 
the type is definied in the first line of file : #!/bin/bash

In this case your path './tfs' is in the same directory, so you need to put it in the same location as tfs, or change the path
 
the type is definied in the first line of file : #!/bin/bash

In this case your path './tfs' is in the same directory, so you need to put it in the same location as tfs, or change the path

alright, this evening gonna try it, and best answer if it's ok, i'm sure you're ok :)
 
Back
Top