launchctl – Start / Stop services

Start/Stop the apache service

$ sudo launchctl start|stop org.apache.httpd

Start/Stop the samba service

$ sudo launchctl start|stop org.samba.nmbd
$ sudo launchctl start|stop org.samba.smbd

List all services

$ sudo launchctl list

Find the name of a service

$ sudo launchctl list|grep samba
-    0    org.samba.smbd
-    0    org.samba.nmbd

List info about one service

$ sudo launchctl list org.samba.smbd
 {
    "Label" = "org.samba.smbd";
    "LimitLoadToSessionType" = "System";
    "OnDemand" = true;
    "LastExitStatus" = 0;
    "TimeOut" = 30;
    "ProgramArguments" = (
                           "/opt/local/sbin/smbd";
                           "-D";
                          );
 };

Links