www-client/brave-bin: version bump to 1.65.126 and fix some pkgcheck warning
[gentoo-zh.git] / net-proxy / v2ray / files / v2ray.initd
blob0fcd1bf3c638144277234c58c0513ab11d8cc8f3
1 #!/sbin/openrc-run
2 # Copyright 1999-2020 Gentoo Authors
3 # Distributed under the terms of the GNU General Public License v2
5 depend() {
6         need net
9 checkconfig() {
10         if [ "${RC_SVCNAME}" != "v2ray" ] ; then
11                 V2_CFGNAME="${RC_SVCNAME#*.}."
12         fi
14         V2_CONFIG="/etc/v2ray/config.${V2_CFGNAME}json"
15         V2_PIDFILE="/run/v2ray.${V2_CFGNAME}pid"
16         V2_LOG="/var/log/v2ray.${V2_CFGNAME}log"
18         if [ ! -f ${V2_CONFIG} ]; then
19                 ewarn "${V2_CONFIG} does not exist."
20                 return 1
21         fi
23         return 0
26 start() {
27         checkconfig || return 1
29         ebegin "Starting V2ray"
30         ebegin "Log File : ${V2_LOG}"
31         start-stop-daemon --start       \
32         -b -1 ${V2_LOG} -2 ${V2_LOG}    \
33         -m -p ${V2_PIDFILE}             \
34         --exec /usr/bin/v2ray  -- -config ${V2_CONFIG}
35         eend $?
39 stop() {
40         checkconfig || return 1
41         ebegin "Stopping V2ray"
42         start-stop-daemon --stop -p ${V2_PIDFILE}
43         eend $?