summaryrefslogtreecommitdiff
path: root/contrib/packages/alpine/gnunet/gnunet-user-services.initd
blob: 0d7a626e7c9894bbcc8b35658a8fab2b87b415e5 (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
			su $user -c "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
			su $user -c "gnunet-arm \
				-c /home/$user/.config/gnunet.conf -e"
		fi
	done
}