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
+16.6k Golang : Read integer from file into array
+5.2k Unix/Linux : How to archive and compress entire directory ?
+19.8k Golang : How to get time from unix nano example
+8.1k Golang : Metaprogramming example of wrapping a function
+19.7k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+6.6k Golang : Check if password length meet the requirement
+45.9k Golang : Read tab delimited file with encoding/csv package
+5.2k Golang : Get FX sentiment from website example
+21.6k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload
+10.5k Golang : Simple File Server
+13.3k Golang : Get constant name from value
+17.5k Golang : Defer function inside init()