Gentoo Archives: gentoo-user

From: Alarig Le Lay <alarig@××××××××××.fr>
To: gentoo-user@l.g.o
Subject: [gentoo-user] How does OpenRC know if a service is crashed?
Date: Thu, 02 Aug 2018 09:32:42
Message-Id: 20180802093223.3bjnp57czg7l2tf7@mew.swordarmor.fr
1 Hi,
2
3 Some times ago, I wrote a basic init script for a service I’m running
4 but that is not in the tree.
5 It’s just a python script behind a reverse-proxy.
6
7 bulbizarre ~ # cat /etc/init.d/paste-py
8 #!/sbin/openrc-run
9 # Copyright 1999-2015 Gentoo Foundation
10 # Distributed under the terms of the GNU General Public License v2
11 # $Header: $
12
13 #depend() {
14 #
15 #}
16
17 start() {
18 start-stop-daemon --start --user pastepy --exec paste-py.sh --name paste-py
19 eend $?
20 }
21
22 stop() {
23 kill $(cat /opt/paste-py/paste.pid)
24 }
25 bulbizarre ~ # cat $(which paste-py.sh)
26 #!/bin/sh
27
28 port="$(grep port /opt/paste-py/paste-py.conf | cut -d '=' -f 2)"
29 addr="$(grep addr /opt/paste-py/paste-py.conf | cut -d '=' -f 2)"
30
31 cd /opt/paste-py
32 source bin/activate
33 ./daemonize.py --port=${port} --addr=${addr}
34 bulbizarre ~ # cat /opt/paste-py/paste.pid
35 9480
36 bulbizarre ~ # ps aux | grep 9480
37 root 493 0.0 0.0 11440 924 pts/3 S+ 11:14 0:00 grep --colour=auto 9480
38 pastepy 9480 0.0 0.4 113548 16848 ? S 08:05 0:00 python ./daemonize.py --port=8087 --addr=127.0.0.1
39
40 So, the process is running (and responding), but OpenRC shows it as
41 crashed
42
43 bulbizarre ~ # rc-status | grep crash
44 paste-py [ crashed ]
45
46 What do I have to change?
47
48 Thanks,
49 --
50 alarig

Replies

Subject Author
Re: [gentoo-user] How does OpenRC know if a service is crashed? Manuel Mommertz <2kmm@×××.de>