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