Gustaf Engström Gustaf Engström - 7 days ago 7
Linux Question

(Linux Mint) - How to restart mono .exe upon crash

I have recently made a Tcp-server in mono develop c#.

My computer runs Linux mint 17

I run this server using

sudo mono Desktop/server.exe

However it crashes every now and then, and I would like to make it restart upon crash, as I otherwise have to go home to my computer to restart it when it crashes.

I realize this is not a stable solution, but it'll do for now.

I've heard of UpStart, but couldn't really understand the documentation.
When I start my program through terminal I can't see any new processes pop up in System Monitor, so I don't know the name of the process of the program either.

(I have been searching around quite a lot, and tried upstart a bunch, but I've had no success with any of my tries. Not even finding the name of the servers process)

Question:
Is there an easy way to detect if my program is running, and if not restart it automatically?

Answer

I have recently made a Tcp-server in mono develop c#.

If you own the code, the best thing to do is to fix the code so it doesn't crash. The only times you want to restart something when it crashes is when you don't have the code or the manpower to fix an issue in the software you're using.