Starting third-party daemons on OpenBSD

Since OpenBSD 4.9, third-party daemons, like MySQL, come with a rc.d script to start, stop and manage the daemon.

Once the package is installed, the managing script is available in /etc/rc.d/.
To start a daemon, just run:

# /etc/rc.d/mysqld start

Now, if you want the daemon to automagically start on boot:

  • check that the script is executable:
    # ls -alh /etc/rc.d/mysqld
    -r-xr-xr-x  1 root  bin   461B Feb 23 22:16 /etc/rc.d/mysqld
  • reference it in the RC configuration file:
    # vi /etc/rc.conf.local
    (...)
    mysqld_flags="--socket=/var/run/mysql/mysql.sock"
    (...)
    rc_scripts="mysqld"
    (...)

Quite simple!

1 Comment

  • jcarnat Fri, 29 Jul 2011 23:19:09 +0000 Reply Author

    BTW, and as stated in rc.conf.local (8), “(…)the rc_scripts variable (is) responsible for starting and stopping rc.d(8) scripts in the specified order(…)”.

    So don’t forget to put dependency daemons first!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

%d bloggers like this: