From a97dfe0b4b3309e499bc8cb26b805d8f03605db5 Mon Sep 17 00:00:00 2001 From: Xero Essential Date: Wed, 12 Nov 2014 18:35:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=81=E6=89=8B=EF=BD=9E=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/xl2tpd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/xl2tpd.sh b/lib/xl2tpd.sh index c3410a4..b7b551f 100755 --- a/lib/xl2tpd.sh +++ b/lib/xl2tpd.sh @@ -4,6 +4,7 @@ # # Copyright (C) 2014 Zeno Zeng # Copyright (C) 2014 Zhang Hai +# Copyright (C) 2014 Xero Essential # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,7 +44,7 @@ xl2tpd_stop() { # for Arch Linux type systemctl >/dev/null 2>&1 && { - systemctl xl2tpd stop + systemctl stop xl2tpd } } @@ -55,12 +56,12 @@ xl2tpd_start() { # for Arch Linux type systemctl >/dev/null 2>&1 && { - systemctl xl2tpd start + systemctl start xl2tpd } # wait until ready for i in $(seq 0 10); do - if [ -e ${XL2TPD_CONTROL_FILE} ]; then + if [ -e ${XL2TPD_CONTROL_FILE} ] || (type systemctl >/dev/null && systemctl status xl2tpd >/dev/null) ; then echo "[INFO] xl2tpd ready." return 0 fi @@ -72,7 +73,7 @@ xl2tpd_start() { } xl2tpd_trystart() { - if [ -e ${XL2TPD_CONTROL_FILE} ]; then + if [ -e ${XL2TPD_CONTROL_FILE} ] || (type systemctl >/dev/null && systemctl status xl2tpd >/dev/null); then echo "[INFO] xl2tpd ready." else xl2tpd_start