This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
openbsd:rc.d [2020/06/12 01:57] drquest [Run HOPM as system daemon] |
openbsd:rc.d [2020/06/12 02:17] drquest [Daemon control and mangement system (rcctl)] |
||
---|---|---|---|
Line 8: | Line 8: | ||
The options are as follows: | 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. | + | -dnbsp;nbsp;nbsp;nbsp;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. | -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. | ||
Line 22: | Line 22: | ||
- | ===== Run a process (here sample process HOPM) as system daemon ===== | + | ===== Run a process as system daemon ===== |
- | * This topic shows how to run hopm as priviledged system daemon which enable it be started/stopped/enabled by rcctl daemon control system | + | * This topic shows how to run a simple process as priviledged system daemon which enable it be started/stopped/enabled by rcctl daemon control system |
+ | * Here we'll use hopm process to explain how to launch it into system daemon. | ||
* For this to work , we'll first install hopm as user hopm, group hopm as usual refer more of it here [[https://ircnow.org/kb/doku.php?id=openbsd:irc:hopm]] | * For this to work , we'll first install hopm as user hopm, group hopm as usual refer more of it here [[https://ircnow.org/kb/doku.php?id=openbsd:irc:hopm]] | ||
- | * and create a rc.d script /etc/rc.d dir by name of "hopm" | + | * Then we'll create a rc.d script in /etc/rc.d dir by name of "hopm" |
- | * We'll lauch the process by calling "rcctl start hopm" | + | * Then We'll lauch the process by calling "rcctl start hopm" with root priviledge |
- | ===== Creating rc.d file for hopm ===== | + | ===== Creating rc.d file for process (hopm) ===== |
Now give following commands - | Now give following commands - | ||
<code> | <code> | ||
Line 33: | Line 34: | ||
doas nano hopm | doas nano hopm | ||
</code> | </code> | ||
- | In nano editor add the following code | + | In nano editor add the following code daemon should be set equal to "/path/to/daemon" |
<code> | <code> | ||
#!/bin/ksh | #!/bin/ksh | ||
Line 45: | Line 46: | ||
doas rcctl enable hopm | doas rcctl enable hopm | ||
</code> | </code> | ||
- | First command will start the hopm with root priviledge system daemon and second command | + | First command will start the processs(hopm) with root priviledge system daemon and second command will enable it to be restarted automatically at booting up. |
- | will enable it to be restarted automatically at booting up. | + | |
* Syntax errors when hopm is running in foreground. This is either the result of missing brackets where needed in config file, or that the file has DOS encodings. See [[https://github.com/ircd-hybrid/hopm/issues/22#issuecomment-301276082]] here. The missing brackets where it was needed may come from the previous section, compared to the line/s where it is indicated by hopm when executed. | * Syntax errors when hopm is running in foreground. This is either the result of missing brackets where needed in config file, or that the file has DOS encodings. See [[https://github.com/ircd-hybrid/hopm/issues/22#issuecomment-301276082]] here. The missing brackets where it was needed may come from the previous section, compared to the line/s where it is indicated by hopm when executed. |