1
0
mirror of https://github.com/QSCTech/zjunet.git synced 2026-01-23 04:04:48 +08:00

update logs

This commit is contained in:
Zeno Zeng 2014-11-22 16:54:34 +08:00
parent 0d30f95dec
commit 088248ed5c
2 changed files with 18 additions and 17 deletions

View File

@ -34,7 +34,6 @@ flush() {
disconnect() { disconnect() {
users=$("${BASEDIR}/user.sh" getall) users=$("${BASEDIR}/user.sh" getall)
for username in $users; do for username in $users; do
echo "[INFO] Logout: ${username}"
"${BASEDIR}/sudo.sh" "${BASEDIR}/xl2tpd.sh" disconnect $username "${BASEDIR}/sudo.sh" "${BASEDIR}/xl2tpd.sh" disconnect $username
done done
"${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh" "${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh"

View File

@ -36,28 +36,25 @@ LOG_FILE=/var/log/zjunet/${USERNAME}
XL2TPD_CONTROL_FILE=/var/run/xl2tpd/l2tp-control XL2TPD_CONTROL_FILE=/var/run/xl2tpd/l2tp-control
xl2tpd_stop() { type systemctl >/dev/null 2>&1
# for Openwrt / Debian / Ubuntu HAVE_SYSTEMD=$?
type systemctl >/dev/null 2>&1 || {
/etc/init.d/xl2tpd stop
}
# for Arch Linux xl2tpd_stop() {
type systemctl >/dev/null 2>&1 && { echo "[INFO] Stopping xl2tpd"
if [ $HAVE_SYSTEMD -eq 0 ]; then
systemctl stop xl2tpd systemctl stop xl2tpd
} else
/etc/init.d/xl2tpd stop
fi
} }
xl2tpd_start() { xl2tpd_start() {
# for Openwrt / Debian / Ubuntu echo "[INFO] Starting xl2tpd"
type systemctl >/dev/null 2>&1 || { if [ $HAVE_SYSTEMD -eq 0 ]; then
/etc/init.d/xl2tpd start
}
# for Arch Linux
type systemctl >/dev/null 2>&1 && {
systemctl start xl2tpd systemctl start xl2tpd
} else
/etc/init.d/xl2tpd start
fi
# wait until ready # wait until ready
for i in $(seq 0 10); do for i in $(seq 0 10); do
@ -73,6 +70,7 @@ xl2tpd_start() {
} }
xl2tpd_trystart() { xl2tpd_trystart() {
echo "[INFO] Try to start xl2tpd if not"
if [ -e ${XL2TPD_CONTROL_FILE} ] || (type systemctl >/dev/null && systemctl status xl2tpd >/dev/null); then if [ -e ${XL2TPD_CONTROL_FILE} ] || (type systemctl >/dev/null && systemctl status xl2tpd >/dev/null); then
echo "[INFO] xl2tpd ready." echo "[INFO] xl2tpd ready."
else else
@ -116,11 +114,15 @@ EOF
} }
xl2tpd_connect() { xl2tpd_connect() {
echo "[INFO] try connecting $1"
xl2tpd-control connect $1 xl2tpd-control connect $1
echo "[INFO] xl2tpd-control done"
} }
xl2tpd_disconnect() { xl2tpd_disconnect() {
echo "[INFO] try disconnecting $1"
xl2tpd-control disconnect $1 xl2tpd-control disconnect $1
echo "[INFO] xl2tpd-control done"
} }
xl2tpd_waituser() { xl2tpd_waituser() {