How to detect the launching of programs on Linux?

For Linux, there appears to be an interface in the kernel. Whilst researching this problem I came across people using CONFIG_CONNECTOR and CONFIG_PROC_EVENTS kernel configuration to get events on process death. Some more google and I found this: http://netsplit.com/2011/02/09/the-proc-connector-and-socket-filters/ The Proc Connector and Socket Filters Posted on February 9, 2011 by scott The proc connector … Read more

Linux PID recycling [closed]

As new processes fork in, PIDs will increase to a system-dependent limit and then wrap around. The kernel will not reuse a PID before this wrap-around happens. The limit (maximum number of pids) is /proc/sys/kernel/pid_max. The manual says: /proc/sys/kernel/pid_max (since Linux 2.5.34) This file specifies the value at which PIDs wrap around (i.e., the value … Read more

How can I list all processes running in Windows?

Finding all of the processes You can do this through the Process class using System.Diagnostics; … var allProcesses = Process.GetProcesses(); Running Diagnostics Can you give us some more information here? It’s not clear what you want to do. The Process class provides a bit of information though that might help you out. It is possible … Read more

What is the best way to ensure only one instance of a Bash script is running? [duplicate]

Advisory locking has been used for ages and it can be used in bash scripts. I prefer simple flock (from util-linux[-ng]) over lockfile (from procmail). And always remember about a trap on exit (sigspec == EXIT or 0, trapping specific signals is superfluous) in those scripts. In 2009 I released my lockable script boilerplate (originally … Read more

How can I get the PID of the parent process of my application

WMI is the easier way to do this in C#. The Win32_Process class has the ParentProcessId property. Here’s an example: using System; using System.Management; // <=== Add Reference required!! using System.Diagnostics; class Program { public static void Main() { var myId = Process.GetCurrentProcess().Id; var query = string.Format(“SELECT ParentProcessId FROM Win32_Process WHERE ProcessId = {0}”, myId); … Read more