1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 03:05:48 +03:00
aports/community/v2ray/v2ray.initd
2022-12-10 11:55:27 +00:00

35 lines
665 B
Bash

#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
V2_CONFIG="/etc/v2ray/config.json"
V2_PIDFILE="/run/v2ray.pid"
V2_LOG="/var/log/v2ray.log"
depend() {
need net
}
checkconfig() {
if [ ! -f ${V2_CONFIG} ]; then
ewarn "${V2_CONFIG} does not exist."
fi
}
start() {
checkconfig || return 1
ebegin "Starting V2ray"
ebegin "Log File : ${V2_LOG}"
start-stop-daemon --start \
-b -1 ${V2_LOG} -2 ${V2_LOG} \
-m -p ${V2_PIDFILE} \
--exec /usr/bin/v2ray -- run -config ${V2_CONFIG}
eend $?
}
stop() {
ebegin "Stopping V2ray"
start-stop-daemon --stop -p ${V2_PIDFILE}
eend $?
}