Mac OSX : Get a process/daemon status information
Problem :
You need to get status information about a process or daemon running on Mac OS X environment to determine if the process or daemon is still running. The information provided by Activity Monitor is just way too much information or you happen to ssh into your Mac OS machine with terminal without GUI. Is there a way to find out if the process or daemon is running or not?
Solution :
Apple has its own tool that replaces init, inetd or service found in other flavours of Unix/Linux. Use launchctl
to get the information you seek. launchctl
is the controlling tool for launchd
.
For example :
To find out the list of available service/process/daemon :
>sudo launchctl list
once you have the list you can query individual process for more information :
>sudo launchctl list com.apple.usbd
will give out :
{
"LimitLoadToSessionType" = "System";
"MachServices" = {
"com.apple.usbd" = mach-port-object;
};
"Label" = "com.apple.usbd";
"TimeOut" = 30;
"OnDemand" = true;
"LastExitStatus" = 0;
"PID" = 160;
"Program" = "/usr/libexec/usbd";
};
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+8.7k Golang : Build and compile multiple source files
+37.6k Golang : Read a text file and replace certain words
+7.1k Linux : How to fix Brother HL-1110 printing blank page problem
+18.4k Unmarshal/Load CSV record into struct in Go
+22.2k Golang : Convert Unix timestamp to UTC timestamp
+18.8k Golang : Calculate entire request body length during run time
+25.7k Mac/Linux and Golang : Fix bind: address already in use error
+4.9k Golang : Issue HTTP commands to server and port example
+11.9k Golang : Simple client-server HMAC authentication without SSL example
+11.4k Get form post value in Go
+15.1k Golang : invalid character ',' looking for beginning of value
+9.6k Golang : Function wrapper that takes arguments and return result example