I want to update an application without any service interruption, the idea is to inform the first instance of the application (aka the old version) when the last (aka the new version) is ready to start.
Example:
- old version is running
- new version starts
- new version detects that old version is already running
- new version prepares to serve
- when ready, new version instructs old version to close
- when closed, old version informs new version
- new version starts serving
When the time comes, the procedure is repeated with a newer version.
This way the service is interrupted for the briefest possible time.
My idea was to use a system-wide mutex, unfortunately they are not available in mono, and it's probably not possible to do step 5 with this technique anyway.
Another approach whould be to use a pipe, this is not available on mono too.
My last idea was to use a socket bound to loopback address on a random (constant) port, do you think this is fine or there is a better way to handle situations like mine?
All the code must run on both linux Mono and .NET.
Thanks for reading, Fabio Iotti.