Autostart Core on Mac » History » Version 9
aleding, 04/09/2017 04:16 AM
Clarified execution parameters for manual load\unload of QuasselCore daemon.
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 | 8 | 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 | 9 | aleding | bq. *NOTE:* The following commands must be *executed by the user who owns the plist-files*. Otherwise, the system will detect an ownership anomaly, throw an error, and refuse to launch the quasselcore daemon. |
49 | 9 | aleding | |
50 | 4 | aleding | *Load:* |
51 | 4 | aleding | |
52 | 4 | aleding | <pre> |
53 | 6 | aleding | launchctl load ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist |
54 | 4 | aleding | </pre> |
55 | 4 | aleding | |
56 | 4 | aleding | *Unload:* |
57 | 4 | aleding | |
58 | 4 | aleding | <pre> |
59 | 6 | aleding | launchctl unload ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist |
60 | 4 | aleding | </pre> |
61 | 4 | aleding | |
62 | 4 | aleding | --- |
63 | 4 | aleding | |
64 | 5 | aleding | h2. Configuring runtime options |
65 | 4 | aleding | |
66 | 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: |
67 | 4 | aleding | |
68 | 4 | aleding | *plist option argument syntax* |
69 | 4 | aleding | |
70 | 4 | aleding | <pre> |
71 | 4 | aleding | <string>OPTION_ARGUMENT</string> |
72 | 4 | aleding | </pre> |
73 | 4 | aleding | |
74 | 4 | aleding | *EXAMPLE 1: listen on non-default port* |
75 | 4 | aleding | |
76 | 4 | aleding | <pre> |
77 | 4 | aleding | <string>-p 12345</string> |
78 | 4 | aleding | </pre> |
79 | 4 | aleding | |
80 | 4 | aleding | *EXAMPLE 2: enable logging to syslog* |
81 | 4 | aleding | |
82 | 4 | aleding | <pre> |
83 | 4 | aleding | <string>--syslog</string> |
84 | 4 | aleding | </pre> |
85 | 4 | aleding | |
86 | 4 | aleding | *EXAMPLE 3: enable debug mode* |
87 | 4 | aleding | |
88 | 4 | aleding | <pre> |
89 | 4 | aleding | <string>-d</string> |
90 | 4 | aleding | |
91 | 4 | aleding | OR |
92 | 4 | aleding | |
93 | 4 | aleding | <string>--debug</string> |
94 | 4 | aleding | </pre> |
95 | 4 | aleding | |
96 | 4 | aleding | *EXAMPLE 4: all of the above along with the _ProgramArguments_ section header* |
97 | 4 | aleding | |
98 | 4 | aleding | <pre><code class="xml"> |
99 | 4 | aleding | <key>ProgramArguments</key> |
100 | 4 | aleding | <array> |
101 | 4 | aleding | <string>/Applications/Quassel/quasselcore</string> |
102 | 4 | aleding | <string>-p 12345</string> |
103 | 4 | aleding | <string>--syslog</string> |
104 | 4 | aleding | <string>-d</string> |
105 | 4 | aleding | </array> |
106 | 4 | aleding | </code></pre> |
107 | 4 | aleding | |
108 | 4 | aleding | --- |
109 | 4 | aleding | |
110 | 5 | aleding | h2. Runtime option list |
111 | 4 | aleding | |
112 | 4 | aleding | <pre> |
113 | 4 | aleding | --debug, -d Enable debug output |
114 | 4 | aleding | |
115 | 4 | aleding | --help, -h Display this help and exit |
116 | 4 | aleding | |
117 | 4 | aleding | --version, -v Display version information |
118 | 4 | aleding | |
119 | 4 | aleding | --configdir, -c <path> Specify the directory holding |
120 | 4 | aleding | configuration files, the SQlite |
121 | 4 | aleding | database and the SSL certificate |
122 | 4 | aleding | --configdir instead |
123 | 4 | aleding | |
124 | 4 | aleding | --listen <<address>[,<address>[,...]]> The address(es) quasselcore will |
125 | 4 | aleding | listen on |
126 | 4 | aleding | |
127 | 4 | aleding | --port, -p <port> The port quasselcore will listen at |
128 | 4 | aleding | |
129 | 4 | aleding | --norestore, -n Don't restore last core's state |
130 | 4 | aleding | |
131 | 4 | aleding | --loglevel, -L <level> Loglevel Debug|Info|Warning|Error |
132 | 4 | aleding | |
133 | 4 | aleding | --syslog Log to syslog |
134 | 4 | aleding | |
135 | 4 | aleding | --logfile, -l <path> Log to a file |
136 | 4 | aleding | |
137 | 4 | aleding | --select-backend <backendidentifier> Switch storage backend (migrating |
138 | 4 | aleding | data if possible) |
139 | 4 | aleding | |
140 | 4 | aleding | --add-user Starts an interactive session to add |
141 | 4 | aleding | a new core user |
142 | 4 | aleding | |
143 | 4 | aleding | --change-userpass <username> Starts an interactive session to |
144 | 4 | aleding | change the password of the user |
145 | 4 | aleding | identified by <username> |
146 | 4 | aleding | |
147 | 4 | aleding | --oidentd Enable oidentd integration |
148 | 4 | aleding | |
149 | 4 | aleding | --oidentd-conffile <file> Set path to oidentd configuration |
150 | 4 | aleding | file |
151 | 4 | aleding | |
152 | 4 | aleding | --require-ssl Require SSL for remote (non-loopback) |
153 | 4 | aleding | client connections |
154 | 4 | aleding | |
155 | 4 | aleding | --ssl-cert <path> Specify the path to the SSL |
156 | 4 | aleding | Certificate |
157 | 4 | aleding | |
158 | 4 | aleding | --ssl-key <path> Specify the path to the SSL key |
159 | 4 | aleding | |
160 | 4 | aleding | --enable-experimental-dcc Enable highly experimental and |
161 | 4 | aleding | unfinished support for CTCP DCC |
162 | 4 | aleding | (DANGEROUS) |
163 | 4 | aleding | </pre> |