summaryrefslogtreecommitdiff
path: root/contrib/packages/alpine/gnunet/gnunet-user-services.initd
blob: 6c960944ea80627ef8561aee804e64db2b03c547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/sbin/openrc-run
# Contributor: xrs <xrs@mail36.net>
# Maintainer: xrs <xrs@mail36.net>

name="gnunet-user-services"
description="GNUnet user services"
command_background="yes"
pidfile="/run/${SVCNAME}.pid"
users=`awk -F ':' '$3>=1000 && $3<2000 {print $1}' /etc/passwd`

depend() {
	need gnunet-system-services
}

start() {
	for user in $users; do
		if test -z "`ps|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1
		then
			sudo -u $user gnunet-arm \
				-c /home/$user/.config/gnunet.conf -s
		fi
	done
}

stop() {
	for user in $users; do
		if test -n "`ps|grep $user|grep gnunet-service-arm`" > /dev/null 2>&1
		then
			sudo -u $user gnunet-arm \
				-c /home/$user/.config/gnunet.conf -e
		fi
	done
}