Determine programmatically if a program is running

You can walk the pid entries in /proc and check for your process in either the cmdline file or perform a readlink on the exe link (The following uses the first method). #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <dirent.h> #include <sys/types.h> pid_t proc_find(const char* name) { DIR* dir; struct dirent* ent; char* … Read more

How to retrieve the process start time (or uptime) in python

By using psutil https://github.com/giampaolo/psutil: >>> import psutil, os, time >>> p = psutil.Process(os.getpid()) >>> p.create_time() 1293678383.0799999 >>> time.strftime(“%Y-%m-%d %H:%M:%S”, time.localtime(p.create_time())) ‘2010-12-30 04:06:23′ >>> …plus it’s cross platform, not only Linux. NB: I am one of the authors of this project.

How to get the error message of a Process?

You need to redirect the standard output or standard error. Here’s a code sample for stdout: Process p = new Process(); p.StartInfo.FileName = “hello.exe”; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.Start(); string stdout = p.StandardOutput.ReadToEnd(); p.WaitForExit();

How to detect win32 process creation/termination in c++

WMI is great and it works with process names too. Although if you need to track process termination the more lightweight and easier way is the following: VOID CALLBACK WaitOrTimerCallback( _In_ PVOID lpParameter, _In_ BOOLEAN TimerOrWaitFired ) { MessageBox(0, L”The process has exited.”, L”INFO”, MB_OK); return; } DWORD dwProcessID = 1234; HANDLE hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)