Browse Source

Merge pull request #2056 from avollmerhaus/master

Add bsd-rc init script to distrib
tags/v2.12.0-rc1
Shivaram Lingamneni 1 year ago
parent
commit
c4db4984a6
No account linked to committer's email address
2 changed files with 74 additions and 0 deletions
  1. 29
    0
      distrib/bsd-rc/README.md
  2. 45
    0
      distrib/bsd-rc/ergo

+ 29
- 0
distrib/bsd-rc/README.md View File

@@ -0,0 +1,29 @@
1
+Ergo init script for bsd-rc
2
+===
3
+
4
+Written for and tested using FreeBSD.
5
+
6
+## Installation
7
+Copy the `ergo` file from this folder to `/etc/rc.d/ergo`,
8
+permissions should be `555`.
9
+
10
+You should create a system user for Ergo.  
11
+This script defaults to running Ergo as a user named `ergo`,  
12
+but that can be changed using `/etc/rc.conf`.
13
+
14
+Here are all `rc.conf` variables and their defaults:
15
+- `ergo_enable`, defaults to `NO`. Whether to run `ergo` at system start.
16
+- `ergo_user`, defaults to `ergo`. Run using this user.
17
+- `ergo_group`, defaults to `ergo`. Run using this group.
18
+- `ergo_chdir`, defaults to `/var/db/ergo`. Path to the working directory for the server. Should be writable for `ergo_user`.
19
+- `ergo_conf`, defaults to `/usr/local/etc/ergo/ircd.yaml`. Config file path. Make sure `ergo_user` can read it.
20
+
21
+This script assumes ergo to be installed at `/usr/local/bin/ergo`.
22
+
23
+## Usage
24
+
25
+```shell
26
+/etc/rc.d/ergo <command>
27
+```
28
+In addition to the obvious `start` and `stop` commands, this  
29
+script also has a `reload` command that sends `SIGHUP` to the Ergo process.

+ 45
- 0
distrib/bsd-rc/ergo View File

@@ -0,0 +1,45 @@
1
+#!/bin/sh
2
+
3
+# PROVIDE: ergo
4
+# REQUIRE: DAEMON
5
+# KEYWORD: shutdown
6
+
7
+#
8
+# Add the following lines to /etc/rc.conf to enable Ergo
9
+#
10
+# ergo_enable (bool): Set to YES to enable ergo.
11
+#                           Default is "NO".
12
+# ergo_user   (user): Set user to run ergo.
13
+#                           Default is "ergo".
14
+# ergo_group (group): Set group to run ergo.
15
+#                           Default is "ergo".
16
+# ergo_config (file): Set ergo config file path.
17
+#                           Default is "/usr/local/etc/ergo/config.yaml".
18
+# ergo_chdir    (dir):  Set ergo working directory
19
+#                           Default is "/var/db/ergo".
20
+
21
+. /etc/rc.subr
22
+
23
+name=ergo
24
+rcvar=ergo_enable
25
+desc="Ergo IRCv3 server"
26
+
27
+load_rc_config "$name"
28
+
29
+: ${ergo_enable:=NO}
30
+: ${ergo_user:=ergo}
31
+: ${ergo_group:=ergo}
32
+: ${ergo_chdir:=/var/db/ergo}
33
+: ${ergo_conf:=/usr/local/etc/ergo/ircd.yaml}
34
+
35
+# If you don't define a custom reload function,
36
+# rc automagically sends SIGHUP to the process on reload.
37
+# But you have to list reload as an extra_command for that.
38
+extra_commands="reload"
39
+
40
+procname="/usr/local/bin/${name}"
41
+command=/usr/sbin/daemon
42
+command_args="-S -T ${name} ${procname} run --conf ${ergo_conf}"
43
+
44
+run_rc_command "$1"
45
+

Loading…
Cancel
Save