How to close .net core console application on linux machine?

Prabs 1 Reputation point
2021-04-26T05:52:33.053+00:00

Hi,
How to close .Net core console application in linux machine?
Becasue .Net core console application is running on terminal window on linux.
If user want to close application,how to allow to user to close it? my application is long running process...
If i close the terminal window,console also will close?

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
316 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,097 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,109 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cheong00 3,466 Reputation points
    2021-04-26T10:54:33.043+00:00

    Adding " &" when running command in *nix will put it into background.

    You can then just ignore it, or use "wait" command to wait until the background process you just run ends.

    Although I'll probably wrap it as systemd service.

    In both way, you can let users kill them by adding the followings to your /etc/sudoers file.

    <username> ALL = /usr/bin/pkill <yourprocessname>
    <username> ALL = /usr/bin/pkill stop <yourservicename>, /usr/bin/pkill start <yourservicename>

    where <username>,<yourprocessname> and <yourservicename> are all placeholders which you should change accordingly.

    0 comments No comments