How to check application already running in C#.Net core with systemd?

Prabs 1 Reputation point
2021-08-04T12:57:01.063+00:00

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 in second time, the application is already running message has to show in terminal window.

Now if i run two times sudo systemctl start testapp.service command, there is no message displaying in terminal window.

Could you please help me on this?

Regards,
Prabs

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

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,386 Reputation points
    2021-08-04T15:44:06.083+00:00

    this is a trivial linux command.

    ps -ax | grep -v grep | grep <program>

    or

    ps -C <program>

    or

    systemctl is-active <service name>

    0 comments No comments