Match only whole word `v2ray` in systemd unit files. (#153)
Also fix SC2143. Co-authored-by: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> Signed-off-by: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com>pull/162/head
parent
bd95556173
commit
656fa81eb9
|
@ -344,7 +344,7 @@ install_v2ray() {
|
||||||
|
|
||||||
# Used to store V2Ray log files
|
# Used to store V2Ray log files
|
||||||
if [[ ! -d '/var/log/v2ray/' ]]; then
|
if [[ ! -d '/var/log/v2ray/' ]]; then
|
||||||
if [[ -n "$(id nobody | grep nogroup)" ]]; then
|
if id nobody | grep -qw 'nogroup'; then
|
||||||
install -d -m 700 -o nobody -g nogroup /var/log/v2ray/
|
install -d -m 700 -o nobody -g nogroup /var/log/v2ray/
|
||||||
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/access.log
|
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/access.log
|
||||||
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/error.log
|
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/error.log
|
||||||
|
@ -442,7 +442,7 @@ check_update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_v2ray() {
|
remove_v2ray() {
|
||||||
if [[ -n "$(systemctl list-unit-files | grep 'v2ray')" ]]; then
|
if systemctl list-unit-files | grep -qw 'v2ray'; then
|
||||||
if [[ -n "$(pidof v2ray)" ]]; then
|
if [[ -n "$(pidof v2ray)" ]]; then
|
||||||
stop_v2ray
|
stop_v2ray
|
||||||
fi
|
fi
|
||||||
|
@ -543,7 +543,7 @@ main() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if V2Ray is running
|
# Determine if V2Ray is running
|
||||||
if [[ -n "$(systemctl list-unit-files | grep 'v2ray')" ]]; then
|
if systemctl list-unit-files | grep -qw 'v2ray'; then
|
||||||
if [[ -n "$(pidof v2ray)" ]]; then
|
if [[ -n "$(pidof v2ray)" ]]; then
|
||||||
stop_v2ray
|
stop_v2ray
|
||||||
V2RAY_RUNNING='1'
|
V2RAY_RUNNING='1'
|
||||||
|
|
Loading…
Reference in New Issue