question

Prabs-7622 avatar image
0 Votes"
Prabs-7622 asked Prabs-7622 edited

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

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?

Regards,
Prabs

dotnet-csharpdotnet-runtimedotnet-cli
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Prabs-7622 avatar image
0 Votes"
Prabs-7622 answered Prabs-7622 edited

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered Bruce-SqlWork edited

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.