Project

General

Profile

Autostart Core on Mac » History » Version 4

aleding, 04/01/2017 12:07 AM
Moderate re-write; added runtime option cfg in plist discussion; added runtime option list

1 4 aleding
{{toc}}
2 1 m4yer
3 4 aleding
h1. Overview
4 1 m4yer
5 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.
6 1 m4yer
7 4 aleding
bq. *NOTE:* The terms _"launch controller"_ or _"controller"_ are used as shorthand in reference to using the *launchctl* command .
8 4 aleding
9 4 aleding
h1. Creating & saving the plist file
10 4 aleding
11 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)_:
12 4 aleding
13 4 aleding
h2. plist example _(by e-jat)_
14 4 aleding
15 4 aleding
<pre><code class="xml">
16 4 aleding
<?xml version="1.0" encoding="UTF-8"?>
17 1 m4yer
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
18 1 m4yer
<plist version="1.0">
19 1 m4yer
<dict>
20 1 m4yer
	<key>Label</key>
21 1 m4yer
	<string>com.quasselcore.daemon</string>
22 1 m4yer
	<key>ProgramArguments</key>
23 1 m4yer
	<array>
24 1 m4yer
		<string>/Applications/Quassel/quasselcore</string>
25 1 m4yer
	</array>
26 1 m4yer
	<key>RunAtLoad</key>
27 1 m4yer
	<true/>
28 1 m4yer
	<key>WorkingDirectory</key>
29 1 m4yer
	<string>/Applications/Quassel</string>
30 1 m4yer
</dict>
31 4 aleding
</plist>
32 4 aleding
</code></pre>
33 1 m4yer
34 4 aleding
h2. plist save location
35 1 m4yer
36 4 aleding
*FILENAME:*  org.quassel-irg.quasselcore.plist
37 4 aleding
*DIRECTORY:*  ~/Library/LaunchAgents/
38 4 aleding
*FULL FILENAME:*  ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist
39 1 m4yer
40 4 aleding
---
41 1 m4yer
42 4 aleding
h1. Manually loading & unloading using the launch controller
43 4 aleding
44 4 aleding
*Load:*
45 4 aleding
46 4 aleding
<pre>
47 4 aleding
launchctl load Library/LaunchAgents/org.quassel-irg.quasselcore.plist
48 4 aleding
</pre>
49 4 aleding
50 4 aleding
*Unload:*
51 4 aleding
52 4 aleding
<pre>
53 4 aleding
launchctl unload Library/LaunchAgents/org.quassel-irg.quasselcore.plist
54 4 aleding
</pre>
55 4 aleding
56 4 aleding
---
57 4 aleding
58 4 aleding
h1. Configuring runtime options
59 4 aleding
60 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:
61 4 aleding
62 4 aleding
*plist option argument syntax*
63 4 aleding
64 4 aleding
<pre>
65 4 aleding
<string>OPTION_ARGUMENT</string>
66 4 aleding
</pre>
67 4 aleding
68 4 aleding
*EXAMPLE 1: listen on non-default port*
69 4 aleding
70 4 aleding
<pre>
71 4 aleding
<string>-p 12345</string>
72 4 aleding
</pre>
73 4 aleding
74 4 aleding
*EXAMPLE 2: enable logging to syslog*
75 4 aleding
76 4 aleding
<pre>
77 4 aleding
<string>--syslog</string>
78 4 aleding
</pre>
79 4 aleding
80 4 aleding
*EXAMPLE 3: enable debug mode*
81 4 aleding
82 4 aleding
<pre>
83 4 aleding
<string>-d</string>
84 4 aleding
85 4 aleding
OR
86 4 aleding
87 4 aleding
<string>--debug</string>
88 4 aleding
</pre>
89 4 aleding
90 4 aleding
*EXAMPLE 4: all of the above along with the _ProgramArguments_ section header*
91 4 aleding
92 4 aleding
<pre><code class="xml">
93 4 aleding
<key>ProgramArguments</key>
94 4 aleding
<array>
95 4 aleding
	<string>/Applications/Quassel/quasselcore</string>
96 4 aleding
	<string>-p 12345</string>
97 4 aleding
	<string>--syslog</string>
98 4 aleding
	<string>-d</string>
99 4 aleding
</array>
100 4 aleding
</code></pre>
101 4 aleding
102 4 aleding
---
103 4 aleding
104 4 aleding
h1. Runtime option list
105 4 aleding
106 4 aleding
<pre>
107 4 aleding
--debug, -d                             Enable debug output
108 4 aleding
109 4 aleding
--help, -h                              Display this help and exit
110 4 aleding
111 4 aleding
--version, -v                           Display version information
112 4 aleding
113 4 aleding
--configdir, -c <path>                  Specify the directory holding
114 4 aleding
                                        configuration files, the SQlite
115 4 aleding
                                        database and the SSL certificate
116 4 aleding
										--configdir instead
117 4 aleding
118 4 aleding
--listen <<address>[,<address>[,...]]>  The address(es) quasselcore will
119 4 aleding
                                        listen on
120 4 aleding
121 4 aleding
--port, -p <port>                       The port quasselcore will listen at
122 4 aleding
123 4 aleding
--norestore, -n                         Don't restore last core's state
124 4 aleding
125 4 aleding
--loglevel, -L <level>                  Loglevel Debug|Info|Warning|Error
126 4 aleding
127 4 aleding
--syslog                                Log to syslog
128 4 aleding
129 4 aleding
--logfile, -l <path>                    Log to a file
130 4 aleding
131 4 aleding
--select-backend <backendidentifier>    Switch storage backend (migrating
132 4 aleding
                                        data if possible)
133 4 aleding
134 4 aleding
--add-user                              Starts an interactive session to add
135 4 aleding
                                        a new core user
136 4 aleding
137 4 aleding
--change-userpass <username>            Starts an interactive session to
138 4 aleding
                                        change the password of the user
139 4 aleding
                                        identified by <username>
140 4 aleding
141 4 aleding
--oidentd                               Enable oidentd integration
142 4 aleding
143 4 aleding
--oidentd-conffile <file>               Set path to oidentd configuration
144 4 aleding
                                        file
145 4 aleding
146 4 aleding
--require-ssl                           Require SSL for remote (non-loopback)
147 4 aleding
                                        client connections
148 4 aleding
149 4 aleding
--ssl-cert <path>                       Specify the path to the SSL
150 4 aleding
                                        Certificate
151 4 aleding
152 4 aleding
--ssl-key <path>                        Specify the path to the SSL key
153 4 aleding
154 4 aleding
--enable-experimental-dcc               Enable highly experimental and
155 4 aleding
                                        unfinished support for CTCP DCC
156 4 aleding
                                        (DANGEROUS)
157 4 aleding
</pre>