Autostart Core on Mac » History » Version 7
aleding, 04/01/2017 02:48 AM
Defined "Intro" section
1 | 5 | aleding | h1. Autostart Core on Mac |
---|---|---|---|
2 | 5 | aleding | |
3 | 4 | aleding | {{toc}} |
4 | 1 | m4yer | |
5 | 7 | aleding | h2. Introduction |
6 | 7 | aleding | |
7 | 4 | aleding | One common method by which to start a daemon on the Mac, either in realtime or at boot, is to use *launchd*. Using this method requires the creation of a property list file _(plist)_ which is used by _launchd_ to start the desired daemon which is, in this particular scenario, the _*quasselcore*_ daemon. Also, while our primary goal is to have the daemon launch at boot, much of the following also applies to manually using _launchd (via the +launchctl+ command)_ to run & stop the same daemon via the command line in realtime. |
8 | 1 | m4yer | |
9 | 4 | aleding | bq. *NOTE:* The terms _"launch controller"_ or _"controller"_ are used as shorthand in reference to using the *launchctl* command . |
10 | 7 | aleding | |
11 | 7 | aleding | --- |
12 | 4 | aleding | |
13 | 5 | aleding | h2. Creating & saving the plist file |
14 | 4 | aleding | |
15 | 4 | aleding | First, we need to create the necessary plist file which will then be saved to the user's launch agent directory - examples and location are provided below _(if the file exists in the proper location, you may skip this step)_: |
16 | 4 | aleding | |
17 | 5 | aleding | h3. plist example _(by e-jat)_ |
18 | 4 | aleding | |
19 | 4 | aleding | <pre><code class="xml"> |
20 | 4 | aleding | <?xml version="1.0" encoding="UTF-8"?> |
21 | 1 | m4yer | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
22 | 1 | m4yer | <plist version="1.0"> |
23 | 1 | m4yer | <dict> |
24 | 1 | m4yer | <key>Label</key> |
25 | 1 | m4yer | <string>com.quasselcore.daemon</string> |
26 | 1 | m4yer | <key>ProgramArguments</key> |
27 | 1 | m4yer | <array> |
28 | 1 | m4yer | <string>/Applications/Quassel/quasselcore</string> |
29 | 1 | m4yer | </array> |
30 | 1 | m4yer | <key>RunAtLoad</key> |
31 | 1 | m4yer | <true/> |
32 | 1 | m4yer | <key>WorkingDirectory</key> |
33 | 1 | m4yer | <string>/Applications/Quassel</string> |
34 | 1 | m4yer | </dict> |
35 | 4 | aleding | </plist> |
36 | 4 | aleding | </code></pre> |
37 | 1 | m4yer | |
38 | 5 | aleding | h3. plist save location |
39 | 1 | m4yer | |
40 | 4 | aleding | *FILENAME:* org.quassel-irg.quasselcore.plist |
41 | 4 | aleding | *DIRECTORY:* ~/Library/LaunchAgents/ |
42 | 4 | aleding | *FULL FILENAME:* ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist |
43 | 1 | m4yer | |
44 | 4 | aleding | --- |
45 | 1 | m4yer | |
46 | 5 | aleding | h2. Manually loading & unloading using the launch controller |
47 | 4 | aleding | |
48 | 4 | aleding | *Load:* |
49 | 4 | aleding | |
50 | 4 | aleding | <pre> |
51 | 6 | aleding | launchctl load ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist |
52 | 4 | aleding | </pre> |
53 | 4 | aleding | |
54 | 4 | aleding | *Unload:* |
55 | 4 | aleding | |
56 | 4 | aleding | <pre> |
57 | 6 | aleding | launchctl unload ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist |
58 | 4 | aleding | </pre> |
59 | 4 | aleding | |
60 | 4 | aleding | --- |
61 | 4 | aleding | |
62 | 5 | aleding | h2. Configuring runtime options |
63 | 4 | aleding | |
64 | 4 | aleding | Several runtime options exist to enhance and modify quasselcore's operation _(see list below)_. These options apply to both daemon launch methods: *(a)* via the controller _(i.e. launchd)_; or *(b)* via the command line. When launching the daemon via the controller, all options are specified in the same plist file created above. Each option is specified by the use of _<string>_ statements in the _ProgramArguments array_ section of the plist. When entering the different options, no white-space or other parsing is entered - the controller will take care of those specifics. Syntax and examples follow: |
65 | 4 | aleding | |
66 | 4 | aleding | *plist option argument syntax* |
67 | 4 | aleding | |
68 | 4 | aleding | <pre> |
69 | 4 | aleding | <string>OPTION_ARGUMENT</string> |
70 | 4 | aleding | </pre> |
71 | 4 | aleding | |
72 | 4 | aleding | *EXAMPLE 1: listen on non-default port* |
73 | 4 | aleding | |
74 | 4 | aleding | <pre> |
75 | 4 | aleding | <string>-p 12345</string> |
76 | 4 | aleding | </pre> |
77 | 4 | aleding | |
78 | 4 | aleding | *EXAMPLE 2: enable logging to syslog* |
79 | 4 | aleding | |
80 | 4 | aleding | <pre> |
81 | 4 | aleding | <string>--syslog</string> |
82 | 4 | aleding | </pre> |
83 | 4 | aleding | |
84 | 4 | aleding | *EXAMPLE 3: enable debug mode* |
85 | 4 | aleding | |
86 | 4 | aleding | <pre> |
87 | 4 | aleding | <string>-d</string> |
88 | 4 | aleding | |
89 | 4 | aleding | OR |
90 | 4 | aleding | |
91 | 4 | aleding | <string>--debug</string> |
92 | 4 | aleding | </pre> |
93 | 4 | aleding | |
94 | 4 | aleding | *EXAMPLE 4: all of the above along with the _ProgramArguments_ section header* |
95 | 4 | aleding | |
96 | 4 | aleding | <pre><code class="xml"> |
97 | 4 | aleding | <key>ProgramArguments</key> |
98 | 4 | aleding | <array> |
99 | 4 | aleding | <string>/Applications/Quassel/quasselcore</string> |
100 | 4 | aleding | <string>-p 12345</string> |
101 | 4 | aleding | <string>--syslog</string> |
102 | 4 | aleding | <string>-d</string> |
103 | 4 | aleding | </array> |
104 | 4 | aleding | </code></pre> |
105 | 4 | aleding | |
106 | 4 | aleding | --- |
107 | 4 | aleding | |
108 | 5 | aleding | h2. Runtime option list |
109 | 4 | aleding | |
110 | 4 | aleding | <pre> |
111 | 4 | aleding | --debug, -d Enable debug output |
112 | 4 | aleding | |
113 | 4 | aleding | --help, -h Display this help and exit |
114 | 4 | aleding | |
115 | 4 | aleding | --version, -v Display version information |
116 | 4 | aleding | |
117 | 4 | aleding | --configdir, -c <path> Specify the directory holding |
118 | 4 | aleding | configuration files, the SQlite |
119 | 4 | aleding | database and the SSL certificate |
120 | 4 | aleding | --configdir instead |
121 | 4 | aleding | |
122 | 4 | aleding | --listen <<address>[,<address>[,...]]> The address(es) quasselcore will |
123 | 4 | aleding | listen on |
124 | 4 | aleding | |
125 | 4 | aleding | --port, -p <port> The port quasselcore will listen at |
126 | 4 | aleding | |
127 | 4 | aleding | --norestore, -n Don't restore last core's state |
128 | 4 | aleding | |
129 | 4 | aleding | --loglevel, -L <level> Loglevel Debug|Info|Warning|Error |
130 | 4 | aleding | |
131 | 4 | aleding | --syslog Log to syslog |
132 | 4 | aleding | |
133 | 4 | aleding | --logfile, -l <path> Log to a file |
134 | 4 | aleding | |
135 | 4 | aleding | --select-backend <backendidentifier> Switch storage backend (migrating |
136 | 4 | aleding | data if possible) |
137 | 4 | aleding | |
138 | 4 | aleding | --add-user Starts an interactive session to add |
139 | 4 | aleding | a new core user |
140 | 4 | aleding | |
141 | 4 | aleding | --change-userpass <username> Starts an interactive session to |
142 | 4 | aleding | change the password of the user |
143 | 4 | aleding | identified by <username> |
144 | 4 | aleding | |
145 | 4 | aleding | --oidentd Enable oidentd integration |
146 | 4 | aleding | |
147 | 4 | aleding | --oidentd-conffile <file> Set path to oidentd configuration |
148 | 4 | aleding | file |
149 | 4 | aleding | |
150 | 4 | aleding | --require-ssl Require SSL for remote (non-loopback) |
151 | 4 | aleding | client connections |
152 | 4 | aleding | |
153 | 4 | aleding | --ssl-cert <path> Specify the path to the SSL |
154 | 4 | aleding | Certificate |
155 | 4 | aleding | |
156 | 4 | aleding | --ssl-key <path> Specify the path to the SSL key |
157 | 4 | aleding | |
158 | 4 | aleding | --enable-experimental-dcc Enable highly experimental and |
159 | 4 | aleding | unfinished support for CTCP DCC |
160 | 4 | aleding | (DANGEROUS) |
161 | 4 | aleding | </pre> |