This is an old revision of the document!
The rcctl utility can enable or disable a base system service or a base system or package daemon in rc.conf.local or display its configuration and status. For a daemon, it can also change the command line arguments, the user to run as, the rc.d action timeout or call its rc.d daemon control script.
The /etc/rc.d directory contains shell scripts to start, stop, and reconfigure daemon programs (“services”).
Services installed from packages may be started at boot time in the order specified by the pkg_scripts variable from rc.conf the order will be reversed during shutdown. Services comprising OpenBSD base are started by rc.
The options are as follows:
-d………Setting this option will print the function names as they are called and prevent the rc.subr framework from redirecting stdout and stderr to /dev/null. This is used to allow debugging of failed actions.
-f………This option only affects the start action. It will forcibly start the daemon whatever value daemon_flags is set to. If daemon_flags is set to “NO”, execution will continue with the script's own defaults unless other flags are specified.
Each such script responds to the following actions:
start………..-Start the service, if not already running.
stop………..-Stop the service.
reload…….-Tell the daemon to reload its configuration.
restart…….-Perform a stop, then a start.
check………-Return 0 if the daemon is running or 1 if it is not.
doas
configured properly. If you do not have this configured properly and are interfacing with your server as root, you are asking for trouble!adduser
before. If not, you can run it and the majority of the defaults are fine.nano
via doas pkg_add nano
. You must know how to use your favourite text editor as I won't cover you on how to use it.Create hopm as its own user.
$ doas adduser Use option ``-silent'' if you don't want to see all warnings and questions. Reading /etc/shells Check /etc/master.passwd Check /etc/group Ok, let's go. Don't worry about mistakes. There will be a chance later to correct any input. Enter username []: hopm Enter full name []: hopm Enter shell bash csh jk_chrootsh ksh nologin sh [ksh]: nologin Uid [1002]: 65532 Login group hopm [hopm]: Login group is ``hopm''. Invite hopm into other groups: guest no [no]: Login class authpf bgpd daemon default pbuild staff unbound znc [default]: daemon Enter password []: Disable password logins for the user? (y/n) [n]: y Name: hopm Password: **** Fullname: hopm Uid: 65532 Gid: 65532 (hopm) Groups: hopm Login Class: daemon HOME: /home/hopm Shell: /sbin/nologin OK? (y/n) [y]: Added user ``hopm'' Copy files from /etc/skel to /home/hopm Add another user? (y/n) [y]: n Goodbye!
Install the necessary wget
package which is required for pulling files. gmake
is required for compiling and installing.
$ doas pkg_add wget gmake
Grab the latest hopm. As of writing, 1.1.6 is the latest.
$ doas -u hopm wget "https://github.com/ircd-hybrid/hopm/archive/1.1.6.tar.gz" -O "/home/hopm/hopm-1.1.6.tar.gz"
Decompress the downloaded tarball, after you navigate into its own home directory.
$ cd /home/hopm $ doas -u hopm tar zxf hopm-1.1.6.tar.gz
Navigate into the extracted path and run configure within it.
$ cd hopm-1.1.6 $ doas -u hopm ./configure
Run gmake
as per instructed. Then gmake install
which will install into its $HOME/hopm
by default.
$ doas -u hopm gmake $ doas -u hopm gmake install
Copy hopm/etc/reference.conf
as hopm/etc/hopm.conf
and edit with your own favourite text editor. In my case I use vim
.
$ cd ../hopm/etc $ doas -u hopm cp reference.conf hopm.conf $ doas -u hopm vim hopm.conf
Make necessary adjustments within the hopm.conf
to suit your server/network configuration. Save and exit out of your own favourite text editor. In the first few running instances, I would enable debug mode to see if there were any issues with the configuration.
$ cd ../bin $ doas -u hopm hopm -dd
Now give following commands -
doas -u hopm cd /etc/rc.d doas -u hopm nano hopm
In nano editor add the following code
#!/bin/ksh daemon="/home/hopm/hopm/bin/hopm" . /etc/rc.d/rc.subr rc_cmd $1
save the file and run the following command.
doas -u hopm rcctl start hopm doas -u hopm rcctl enable hopm
First command will start the hopm as non priviledged system daemon and second command will enable it to be restarted automatically at booting up.