Answer the question
In order to leave comments, you need to log in
How to make automatic update of console application in Linux on .Net Core?
I am developing a standalone console application for Linux using .Net Core. It is required that the application itself be updated via the Internet.
I decided to use the following sequence of actions:
- the application downloads the new version,
- updates (replaces) its files,
- restarts (using Process.Start).
But! Restarting the application runs into a "Permission denied" error, a problem that didn't exist on Windows. The bottom line is that after replacing the executable file, permission to run is reset from it.
How to bypass it?
Answer the question
In order to leave comments, you need to log in
Just set the rights after installing the updated version.
http://docs.go-mono.com/?link=T%3aMono.Unix.Native...
Everything has already been said about attributes. But if you upload to /tmp , then the execution attributes there may be reset or simply not run from there, depending on the /tmp mount options!
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec)
Here I have - nosuid (prohibit suid bit), noexec (prohibit execution), nodev (prohibit device descriptors).
My update process takes place in several stages
1) the application launch script checks the link in /tmp/uploaded
- if there is, it launches the application using this link with the --uploaded=path-to-new-version parameter and deletes the link itself (!)
- if not - launches the application at the standard location
2) the application checks its functionality using the --uploaded key, and if everything is fine, it makes a link to the current version to the standard place of the application, or it crashes by mistake.
3) When the new version is downloaded, a link is made to it in /tmp/uploaded and the application is extinguished
4) the application is restarted
As a result, even if the application with errors is uploaded, I always have the old version.
Create a package and deploy in the right way.
https://medium.com/bluekiri/packaging-a-net-core-s...
Or even easier, just change the file a bit.
https://github.com/qmfrederik/dotnet-packaging
Here I described how
How to build a light assembly of a .NET Core application?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question