How to give input parameters to systemctl start testapp.service using C#.Net Core and systemd?

Prabs 1 Reputation point

Hello Team,

I have a C# .NET Core 3.1 daemon application which is running in RedHat Linux. Application output type is console application

I have one new requirement.
When i run the sudo systemctl start testapp.service command, application has to wait for config file path provided by user.

I tried the following code but it is not showing in Linux terminal window

Console.WriteLine("Enter config file path :");
string configFilepath = Console.ReadLine();

Could you please help me on this?


A cross-platform toolchain for developing, building, running, and publishing .NET applications.
324 questions
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,411 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,132 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce ( 58,126 Reputation points

    apps started systemctl don't have access to the console.

    You should use command line arguments rather than the console. But can just pipe an an input file as stdin, or depending on the shell you use, pipe an variable as input.

    You should really learn some standard Linux commands.

    0 comments No comments

  2. Prabs 1 Reputation point

    My application has to run on background at Linux OS and need to use start,status,stop commands.
    That's why i go for Daemon process.

    How to use command line arguments in C#.Net core 3.1? if i go this way,start,stop,status commands possible to check

    0 comments No comments