summaryrefslogtreecommitdiff
path: root/pcr/i2p/i2p.initd
blob: 47299e1b89a0f4f1b36ce04cdad53115ac4e0642 (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
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/openrc-run
# Distributed under the terms of the GNU General Public License v3

user="${user:-i2p}"
group="${group:-i2p}"
pidfile="/run/i2p/$RC_SVCNAME.pid"
command="/usr/bin/java-service-wrapper"
command_args="/opt/i2p/wrapper.config wrapper.name=i2prouter wrapper.syslog.ident=i2prouter wrapper.daemonize=TRUE TZ=UTC"
command_background=1
workdir=/opt/i2p

depend() {
	use net
	need localmount
}

start() {
	ebegin "Start ${SVCNAME}"

	cd $workdir
	export HOME=$workdir
	su -s /bin/sh -c "$command $command_args" $user

	eend $?
	return 0;
}

stop() {
	ebegin "Stopping ${SVCNAME}"

	/bin/kill -TERM $(cat $pidfile)

	eend $?
	return 0;
}

reload() {
	ebegin "Reload ${SVCNAME}"

	/bin/kill -USR1 $(cat $pidfile)

	eend $?
	return 0;
}