Sfoglia il codice sorgente

distrib: refine OpenRC init scripts

- Add logging to init script
- Add delay so OpenRC realises if we crashed quickly b/c of e.g. bad config
   file
- General cleanups (like supporting multiple instances, style changes)

This should make it a lot easier to see what's going wrong when something
breaks.

Bug: ergochat/ergo#1914
Signed-off-by: Sam James <sam@gentoo.org>
tags/v2.10.0-rc1
Sam James 2 anni fa
parent
commit
7c766b2096
Nessun account collegato all'indirizzo email del committer
2 ha cambiato i file con 18 aggiunte e 4 eliminazioni
  1. 1
    0
      distrib/openrc/ergo.confd
  2. 17
    4
      distrib/openrc/ergo.initd

+ 1
- 0
distrib/openrc/ergo.confd Vedi File

1
 # /etc/conf.d/ergo: config file for /etc/init.d/ergo
1
 # /etc/conf.d/ergo: config file for /etc/init.d/ergo
2
 ERGO_CONFIGFILE="/etc/ergo/ircd.yaml"
2
 ERGO_CONFIGFILE="/etc/ergo/ircd.yaml"
3
+ERGO_USERNAME="ergo"

+ 17
- 4
distrib/openrc/ergo.initd Vedi File

1
 #!/sbin/openrc-run
1
 #!/sbin/openrc-run
2
+name=${RC_SVCNAME}
3
+description="ergo IRC daemon"
4
+
2
 command=/usr/bin/ergo
5
 command=/usr/bin/ergo
3
-command_args="run --conf ${ERGO_CONFIGFILE:-"/etc/ergo/ircd.yaml"}"
6
+command_args="run --conf ${ERGO_CONFIGFILE:-'/etc/ergo/ircd.yaml'}"
7
+command_user=${ERGO_USERNAME:-ergo}
4
 command_background=true
8
 command_background=true
9
+
10
+pidfile=/var/run/${RC_SVCNAME}.pid
11
+
12
+output_log="/var/log/${RC_SVCNAME}.out"
13
+error_log="/var/log/${RC_SVCNAME}.err"
14
+# --wait: to wait 1 second after launching to see if it survived startup
15
+start_stop_daemon_args="--wait 1000"
16
+
5
 extra_started_commands="reload"
17
 extra_started_commands="reload"
6
-pidfile=/var/run/ergo.pid
7
-name="ergo"
8
-description="ergo IRC daemon"
9
 
18
 
10
 depend() {
19
 depend() {
11
 	use dns
20
 	use dns
12
 	provide ircd
21
 	provide ircd
13
 }
22
 }
14
 
23
 
24
+start_pre() {
25
+	checkpath --owner ${command_user}:${command_user} --mode 0640 --file /var/log/${RC_SVCNAME}.out /var/log/${RC_SVCNAME}.err
26
+}
27
+
15
 reload() {
28
 reload() {
16
 	ebegin "Reloading ${RC_SVCNAME}"
29
 	ebegin "Reloading ${RC_SVCNAME}"
17
 	start-stop-daemon --signal HUP --pidfile "${pidfile}"
30
 	start-stop-daemon --signal HUP --pidfile "${pidfile}"

Loading…
Annulla
Salva