• 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 Re-Open server after global save

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
How to make it on ubuntu:

- when global save (7:00)
- restart the ubuntu machine
- and re open server

What is the best way?

Code:
[6:55:03.589] > Broadcasted message: "Server is going down for a global save within 5 minutes. Please logout.".
[6:57:03.590] > Broadcasted message: "Server is going down for a global save within 3 minutes. Please logout.".
[6:59:03.590] > Broadcasted message: "Server is going down for a global save in one minute, please logout!".
[7:0:03.791] PLAYERS has logged out.
[7:0:04.181] > Saving server...
[7:0:05.537] > SAVE: Complete in 1.356 seconds using relational house storage.
[7:0:05.987] Preparing to shutdown the server- done.
kenny@kenny-DC8CU41:~/Documentos/server$ ./tfs
 
Last edited:
make a "bat auto restarter" is one way then make it run it automatically.

Bat on linux? Its work?

while true; do ./tfs; done (instead of only ./tfs)
will restart it until you make Ctrl+C


No time conditional? Where i supossed to paste it? And how to restart?

Make it so it saves without shutting down the server?

To all be light, when i restart the machine and restart the server all will be clean (computer and server)
 
when you run your OT you write ./tfs
but instead of writing that, you write this (entire line, exactly as I wrote it):
while true; do ./tfs; done
 
- when global save (7:00)
- restart the ubuntu machine
- and re open server
The best way IMO to achieve this would be to setup a Cron Job that runs a shell script after reboot.

Add this to Cron Jobs:
Code:
@reboot /path/to/dir/restarter.sh

Create a file named restarter.sh at the path you set in Cron Jobs then write this in the file:
Code:
while true; do ./tfs; done
Now everytime the dedicated server starts it will run the restarter.sh.

To be able to restart the dedicated server itself you can setup a Cron Job aswell on a certain time.
Code:
0 7 * * * /sbin/shutdown -r now

The first number in this case 0 is minutes.
The second number in this case 7 is hours.
The stars (*) means every day of every month.

With this Cron Job the server will reboot at 07:00.
 
The best way IMO to achieve this would be to setup a Cron Job that runs a shell script after reboot.

Code:
while true; do ./tfs; done
This is not an infinite loop?
infinite loop will take a little unnecessary processing
I can not make variable

For exemple:
Code:
check if ot is open
else
cd /home/kenny/Documentos/server
./tfs;

---------------------------------------------------

This 2 i need do on Linux command terminal after put my 'restart.sh'
In /home/kenny/Documentos/server/restart
Right?

Code:
@reboot /home/kenny/Documentos/server/restart/restarter.sh

Code:
5 7 * * * /sbin/shutdown -r now

I dont need install nothing? How to remove after? I will test it on my ubuntu desktop, i dont have a VPS yet
 
No you don't need to install anything Cron Jobs is already in the OS.

What do you want to remove after?

Oh ty, i didn't know it

I told about remove, to remove the task
Cause i will test in my main computer (my ubuntu desktop) after when i get my host i will put there


Did u know answer my others questions?
Code:
while true; do ./tfs; done
This is not an infinite loop?
infinite loop will take a little unnecessary processing
I can not make variable

For exemple:
Code:
check if ot is open
else
cd /home/kenny/Documentos/server
./tfs;

---------------------------------------------------

This 2 i need do on Linux command terminal after put my 'restart.sh'
In /home/kenny/Documentos/server/restart
Right?

Code:
@reboot /home/kenny/Documentos/server/restart/restarter.sh

Code:
5 7 * * * /sbin/shutdown -r now

I dont need install nothing? How to remove after? I will test it on my ubuntu desktop, i dont have a VPS yet
 
I have 3 doublets

1- Restart distro, close the ./tfs and re open
Will give better performance?

2- Restart computer, vps
Will give better performance?

3- Restart distro, close the ./tfs and re open AND Restart computer, vps
Will give better performance?

Why?
 
@kennyubuntu infinities loops aren't that bad, you need them some times, if you do a script like you mentioned before, it will only run once and stops, on other hand infinite loop will check every time, if you need that much this piece of performace make a check time by time, (hour by hour?), to do that you need Cron use this syntax.
┌───────────── min (0 - 59)
│ ┌────────────── hour (0 - 23)
│ │ ┌─────────────── day of month (1 - 31)
│ │ │ ┌──────────────── month (1 - 12)
│ │ │ │ ┌───────────────── day of week (0 - 6)
│ │ │ │ │
│ │ │ │ │
*_*_*_*_* command to execute

@gmstrikker it gives just because you clean cached data from ram, thats why real tibia restarts every day, to save cached data to a storage and clean the ram, but you surely don't need to do that, tibia use hundred times more ram than tfs.
 
Last edited:
All right here?
Code:
cd /home/nazir/Documentos/server && do./tfs;done

After on linux terminal:
Code:
@reboot/home/nazir/Documentos/server/restart/restarter.sh

Code:
0 6 * * * /sbin/shutdown -r now

Just need do it?
 
After on linux terminal:
Code:
@reboot/home/nazir/Documentos/server/restart/restarter.sh
reboot is a string not a path, all strings available are:
@reboot
@yearly
@annually
@monthly
@weekly
@daily
@Midnight
@hourly

example:
@daily /path/to/script.sh

@reboot will run once whenever you startup the system.
 
This is not an infinite loop?
infinite loop will take a little unnecessary processing
I can not make variable
This won't affect your performance.

This 2 i need do on Linux command terminal after put my 'restart.sh'
In /home/kenny/Documentos/server/restart
Right?
Place the shell script 'restart.sh' at your desired location and edit the Cron Jobs and you're ready to go.
 
Hello Guys.
I write this in the final line to open the server.
./build/tfs
But when it goes to global save it just closes the server (it doesnt re openes it)
should i also write
while true; do ./tfs; ? or while true; do ./build/tfs; ?

Thanks in advance.
 
The best way IMO to achieve this would be to setup a Cron Job that runs a shell script after reboot.

Add this to Cron Jobs:
Code:
@reboot /path/to/dir/restarter.sh

Create a file named restarter.sh at the path you set in Cron Jobs then write this in the file:
Code:
while true; do ./tfs; done
Now everytime the dedicated server starts it will run the restarter.sh.

To be able to restart the dedicated server itself you can setup a Cron Job aswell on a certain time.
Code:
0 7 * * * /sbin/shutdown -r now

The first number in this case 0 is minutes.
The second number in this case 7 is hours.
The stars (*) means every day of every month.

With this Cron Job the server will reboot at 07:00.


How do I access cron?
 
Hello Guys.
I write this in the final line to open the server.
./build/tfs
But when it goes to global save it just closes the server (it doesnt re openes it)
should i also write
while true; do ./tfs; ? or while true; do ./build/tfs; ?

Thanks in advance.

After you compile tfs (you get build/tfs), you should move the tfs file outside of the build folder (so it is in the same folder/directory as config.lua).
And then use the loop command.

while true; do ./tfs; done

Is basically Linux/shell shorthand for this:
Lua:
while true == true do
  os.execute(_DIR_ .. '/tfs')
end

The execution of the tfs binary isn't done until the server either shutdown or crashes, and since true will always be true, the while condition will continue to execute infinitely. So every time the server crashes or shuts down, it will just start it again.

@kennyubuntu

There is no uneccesary processing here, as it will only continue the script after tfs is done executing. It doesn't loop 1000+ times a second, only once every crash/shutdown.
 
Back
Top