Project

General

Profile

Autostart Core on Mac » History » Version 9

Version 8 (aleding, 04/09/2017 03:57 AM) → Version 9/10 (aleding, 04/09/2017 04:16 AM)

h1. Autostart Core on Mac

{{toc}}

h2. Introduction

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.

bq. *NOTE:* The terms _"launch controller"_ or _"controller"_ are used as shorthand in reference to using the *launchctl* command.

---

h2. Creating & saving the plist file

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)_:

h3. plist example _(by e-jat)_

<pre><code class="xml">
<?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.quasselcore.daemon</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Quassel/quasselcore</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/Applications/Quassel</string>
</dict>
</plist>
</code></pre>

h3. plist save location

*FILENAME:* org.quassel-irg.quasselcore.plist
*DIRECTORY:* ~/Library/LaunchAgents/
*FULL FILENAME:* ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist

---



h2. Manually loading & unloading using the launch controller

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.

*Load:*

<pre>
launchctl load ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist
</pre>

*Unload:*

<pre>
launchctl unload ~/Library/LaunchAgents/org.quassel-irg.quasselcore.plist
</pre>

---



h2. Configuring runtime options

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:

*plist option argument syntax*

<pre>
<string>OPTION_ARGUMENT</string>
</pre>

*EXAMPLE 1: listen on non-default port*

<pre>
<string>-p 12345</string>
</pre>

*EXAMPLE 2: enable logging to syslog*

<pre>
<string>--syslog</string>
</pre>

*EXAMPLE 3: enable debug mode*

<pre>
<string>-d</string>

OR

<string>--debug</string>
</pre>

*EXAMPLE 4: all of the above along with the _ProgramArguments_ section header*

<pre><code class="xml">
<key>ProgramArguments</key>
<array>
<string>/Applications/Quassel/quasselcore</string>
<string>-p 12345</string>
<string>--syslog</string>
<string>-d</string>
</array>
</code></pre>

---

h2. Runtime option list

<pre>
--debug, -d Enable debug output

--help, -h Display this help and exit

--version, -v Display version information

--configdir, -c <path> Specify the directory holding
configuration files, the SQlite
database and the SSL certificate
--configdir instead

--listen <<address>[,<address>[,...]]> The address(es) quasselcore will
listen on

--port, -p <port> The port quasselcore will listen at

--norestore, -n Don't restore last core's state

--loglevel, -L <level> Loglevel Debug|Info|Warning|Error

--syslog Log to syslog

--logfile, -l <path> Log to a file

--select-backend <backendidentifier> Switch storage backend (migrating
data if possible)

--add-user Starts an interactive session to add
a new core user

--change-userpass <username> Starts an interactive session to
change the password of the user
identified by <username>

--oidentd Enable oidentd integration

--oidentd-conffile <file> Set path to oidentd configuration
file

--require-ssl Require SSL for remote (non-loopback)
client connections

--ssl-cert <path> Specify the path to the SSL
Certificate

--ssl-key <path> Specify the path to the SSL key

--enable-experimental-dcc Enable highly experimental and
unfinished support for CTCP DCC
(DANGEROUS)
</pre>