You can get the information about running processes with launchctl
.
One possibility is querying launchd
with launchctl list
command.
list [-x] [label]
With no arguments, list all of the jobs loaded into launchd in three
columns. The first column
displays the PID of the job if it is running. The second column displays the last exit status
of the job. If the number in this column is negative, it represents the negative of the signal
which killed the job. Thus, "-15" would indicate that the job was terminated with SIGTERM.
The third column is the job's label.
If your plist is loaded, it should be listed, otherwise not. Also first column contains pid
of the process, so you could check if the process is running, for example:
$ launchctl list |grep myprocess
600 0 org.example.myprocess.1234
There is also launchctl print
command that gives detailed output about a process. Check if you can use it.
print domain-target | service-target
Prints information about the specified service or domain. Domain
output includes various properties about the domain as well as a list
of services and endpoints in the domain with state pertaining to each. Service output includes various properties of the service, including information about its
origin on-disk, its current state, execution context, and last exit status.
For example:
$ launchctl print gui/501/org.example.myprocess.1234 | grep state
state = running