Note: The operation of the front, such as with sudo, or only the current user's services, there will be unable to operate some root users of the service problem. The system version is Mac 10.12.
1. After plist configuration:
#/system/library/launchdaemons/ssh. # Uninstall a service sudo launchctl unload
2. View all services:
sudo launchctl list
3. View service Status
sudo launchctl list | grep <<service name>>
The output has the following meanings:
- The first number is the PID of the process, if it is running, if it does not run, it shows a '-'.
- The second number is the exit code for the process if it has already been completed. If it is negative, it is the number that kills the signal.
- The third column is the process name.
4. Service operation
#<<service name>>#start <<service name>>#<< Service name>>
5, more usage Direct input: Launchctl Help for viewing.
Reference:
Https://stackoverflow.com/questions/36594650/command-to-get-the-service-status-of-mac-os
Https://serverfault.com/questions/194832/how-to-start-stop-restart-launchd-services-from-the-command-line
Simple usage of Mac using LAUNCHD command line LAUCHCTL operation service