Jump to content

Ubuntu auto restart script?

Very simple question, I have a tes3mp morrowind server that I'm hosting on my ubuntu machine. It works great! Except every like 8 hours it crashes from stack overflow, no idea if it's somthing the players do or if it's somthing with my machine but I restart it and all is good again. It seems to use very little in the way of resources so I don't think it's that..... so basically I need somthing simple, how do I make it so when it crashes it just starts the server script again? If you know nothing about the game that's fine I just need a way to auto restart a script. Thanks :)

Link to comment
Share on other sites

Link to post
Share on other sites

Server crash because of stack overflow is a known issue.

My suggestion to you would be to use some scripting tools that BASH provides you with. Specifically the "while" loop.

For example, if you open the command line, navigate to directory where tes3mp-server is located and run

while :; do ./tes3mp-server; done

then the server will always start again after it reaches stack overflow.
But that would leave you with a window that would have to be always open in order to keep TES3MP server running.
I suggest you use tmux to work around that. Install tmux, and run "tmux" command in order to start a session, enter the command I wrote above and then press Ctrl+B and then press D. You will be back at blank terminal again and you can close that window. In order to see what is happening with TES3MP server again, run "tmux attach-session -t 0" command. Overall I suggest you look at what tmux is capable of, as it might come in handy many more times on your GNU+Linux journey.

There are other ways of getting a program to automatically restart on Linux (for example making a daemon / service), but they are all more complex.

The community around TES3MP is quite tech saavy, so feel free to visit the Steam group or Discord server to get more support regarding this.

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, testman said:

Server crash because of stack overflow is a known issue.

My suggestion to you would be to use some scripting tools that BASH provides you with. Specifically the "while" loop.

For example, if you open the command line, navigate to directory where tes3mp-server is located and run


while :; do ./tes3mp-server; done

then the server will always start again after it reaches stack overflow.
But that would leave you with a window that would have to be always open in order to keep TES3MP server running.
I suggest you use tmux to work around that. Install tmux, and run "tmux" command in order to start a session, enter the command I wrote above and then press Ctrl+B and then press D. You will be back at blank terminal again and you can close that window. In order to see what is happening with TES3MP server again, run "tmux attach-session -t 0" command. Overall I suggest you look at what tmux is capable of, as it might come in handy many more times on your GNU+Linux journey.

There are other ways of getting a program to automatically restart on Linux (for example making a daemon / service), but they are all more complex.

The community around TES3MP is quite tech saavy, so feel free to visit the Steam group or Discord server to get more support regarding this.

Cool thanks! This machine is purely a server so open windows are nothing 

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×