3 votos

¿Cómo uso la impresión launchctl?

He hecho una launchd servicio de archivo, a continuación, comenzó. Ahora quiero usar el launchctl print comando pero no estoy seguro de cómo.

Leo: ¿Cuál es la diferencia entre un "nombre de servicio" y un " servicio de destino`? y trató de usar la id -u comando con el user/ prefijo, pero también funcionó.

¿Cómo puedo utilizar la launchtl comando imprimir con mi com.foo.http servicio?

$ cat <<'EOF' > ~/Library/LaunchAgents/com.foo.http.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.foo.http</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/python3</string>
    <string>-m</string>
    <string>http.server</string>
    <string>3000</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <true/>
</dict>
</plist>
EOF
$ launchctl load ~/Library/LaunchAgents/com.foo.http.plist
$ launchctl list | grep com.foo.http
66590   0   com.foo.http
$ launchctl print ~/Library/LaunchAgents/com.foo.http.plist
Unrecognized target specifier. <service-target> takes a form of <domain-target>/<service-id>.
Please refer to `man launchctl` for explanation of the <domain-target> specifiers.
Usage: launchctl print <domain-target> | <service-target>
$ launchctl print com.foo.http
Unrecognized target specifier. <service-target> takes a form of <domain-target>/<service-id>.
Please refer to `man launchctl` for explanation of the <domain-target> specifiers.
Usage: launchctl print <domain-target> | <service-target>
$ launchctl print user/$(id -u)/com.foo.http
Could not find service "com.foo.http" in domain for uid: 501
$ launchctl version
Darwin Bootstrapper Version 6.0.0: Thu Apr 25 23:14:22 PDT 2019; root:libxpc_executables-1336.261.2~6/launchd/RELEASE_X86_64

11voto

user180817 Puntos 343

Como lo mencionó @GordonDavisson en su comentario ¿Cómo uso la impresión launchctl? usa este comando

 launchctl print gui/$(id -u)/com.foo.http
 

AppleAyuda.com

AppleAyuda es una comunidad de usuarios de los productos de Apple en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X