Each daemon app needs to have a property file. This file contains information about the daemon, including the list of sockets or file descriptors it uses to process requests. Specifying this information in a property list file lets launchd register the corresponding file descriptors and launch your daemon only after a request arrives for your daemon’s services. Table 5-1 lists the required and recommended keys for all daemons.
The property list file is structured the same for both daemons and agents. You indicate whether it describes a daemon or agent by the directory you place it in. Property list files describing daemons are installed in /Library/LaunchDaemons, and those describing agents are installed in /Library/LaunchAgents or in the LaunchAgents subdirectory of an individual user’s Library directory.
Below is an example
!?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.example.hello!string>
!key>ProgramArguments!key>
!array>
!string>hello!string>
!string>world!string>
!/array>
!key>KeepAlive!key>
!true/>
!/dict>
!/plist>
References:
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html#//apple_ref/doc/uid/10000172i-SW7-BCIEDDBJ
The property list file is structured the same for both daemons and agents. You indicate whether it describes a daemon or agent by the directory you place it in. Property list files describing daemons are installed in /Library/LaunchDaemons, and those describing agents are installed in /Library/LaunchAgents or in the LaunchAgents subdirectory of an individual user’s Library directory.
Below is an example
!?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.example.hello!string>
!key>ProgramArguments!key>
!array>
!string>hello!string>
!string>world!string>
!/array>
!key>KeepAlive!key>
!true/>
!/dict>
!/plist>
References:
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html#//apple_ref/doc/uid/10000172i-SW7-BCIEDDBJ
No comments:
Post a Comment