Service Manager rcctl on OpenBSD
Rcctl is a daemon management program on the OpenBSD system. It functions similar to chkconfig on RedHat Linux or systemctl in the new version.
It is actually a shell script program, first seen in OpenBSD 5.7. You must have the root permission.
The principle is to configure the corresponding process in the/etc/rc. conf. local file. The managed process must have corresponding control script files in the/etc/rc. d/directory.
Main functions and Examples
(The following content is mainly translated Based on the rcctl man manual. I will add some examples. You can read man's Manual by yourself)
Enable or disable background processes (including built-in processes such as httpd and processes such as mysqld/nginx installed through software packages)
Rcctl enable httpd # enable
Rcctl disable httpd # disable
Start or stop background processes
Rcctl start httpd
Rcctl stop httpd
You can also input the-d (enable debug) or-f (Force) parameters as needed.
List process-related parameters
# Rcctl get httpd
Httpd_class = daemon
Httpd_flags =
Httpd_timeout = 30
Httpd_user = root
List default Process Parameters
# Rcctl getdef httpd
Httpd_class = daemon
Httpd_flags =
Httpd_timeout = 30
Httpd_user = root
If you have not modified the default parameter, it should be the same as the get sub-command output.
List processes that meet specific conditions
Rcctl ls $ con
List qualified processes. The conditions here cannot be customized. You can only select the following keywords:
All services and daemons # all services and processes
Faulty enabled but stopped daemons # services and processes enabled but not started
Off disabled services and daemons # disabled services and processes
On enabled services and daemons # enabled services and processes
Started running daemons # started processes
Stopped daemons # stopped Processes
# Rcctl ls faulty
Httpd
Ntpd
Here, the httpd and ntpd processes have been enabled but cannot be started (this means the Administrator has been active ).
Adjust the process sequence in pkg_scripts
The pkg_scripts variable is used to control the processes installed from the software package. When there are multiple processes, we sometimes need to adjust their order.
Rcctl order d # Move the specified process d to the first place:
Rcctl order d d1 d2 # Move the specified process d before d1 and d2
Rcctl order # list the current order
Set Process Parameters
Rcctl set httpd status on # It should be the same as rcctl enable httpd. I have not found any difference between the two.
Rcctl set ntpd flags-s # set the flags parameter of ntpd to '-S'
This article permanently updates the link address: