luci-app-passwall: sync upstream
This commit is contained in:
parent
efe4424d61
commit
c9976e749a
23
luci-app-passwall/root/etc/hotplug.d/iface/98-passwall
Normal file
23
luci-app-passwall/root/etc/hotplug.d/iface/98-passwall
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
[[ "$ACTION" == "ifup" && $(uci get "passwall.@global[0].enabled") == "1" ]] && [ -f /var/lock/passwall_ready.lock ] && {
|
||||
default_device=$(ip route | grep default | awk -F 'dev ' '{print $2}' | awk '{print $1}')
|
||||
[ "$default_device" == "$DEVICE" ] && {
|
||||
LOCK_FILE_DIR=/var/lock
|
||||
[ ! -d ${LOCK_FILE_DIR} ] && mkdir -p ${LOCK_FILE_DIR}
|
||||
LOCK_FILE="${LOCK_FILE_DIR}/passwall_ifup.lock"
|
||||
if [ -s ${LOCK_FILE} ]; then
|
||||
SPID=$(cat ${LOCK_FILE})
|
||||
if [ -e /proc/${SPID}/status ]; then
|
||||
exit 1
|
||||
fi
|
||||
cat /dev/null > ${LOCK_FILE}
|
||||
fi
|
||||
echo $$ > ${LOCK_FILE}
|
||||
|
||||
/etc/init.d/passwall restart >/dev/null 2>&1 &
|
||||
echo "passwall: restart when $INTERFACE ifup" > /dev/kmsg
|
||||
|
||||
rm -rf ${LOCK_FILE}
|
||||
}
|
||||
}
|
@ -33,7 +33,13 @@ unlock() {
|
||||
}
|
||||
|
||||
boot() {
|
||||
$APP_FILE boot
|
||||
local delay=$(uci -q get ${CONFIG}.@global_delay[0].start_delay || echo 1)
|
||||
if [ "$delay" -gt 0 ]; then
|
||||
$APP_FILE echolog "执行启动延时 $delay 秒后再启动!"
|
||||
sleep $delay
|
||||
fi
|
||||
restart
|
||||
touch ${LOCK_FILE_DIR}/${CONFIG}_ready.lock
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -1576,16 +1576,6 @@ acl_app() {
|
||||
}
|
||||
}
|
||||
|
||||
boot() {
|
||||
local delay=$(config_t_get global_delay start_delay 1)
|
||||
if [ "$delay" -gt 0 ]; then
|
||||
echolog "执行启动延时 $delay 秒后再启动!"
|
||||
sleep $delay && start >/dev/null 2>&1 &
|
||||
else
|
||||
start
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
ulimit -n 65535
|
||||
start_haproxy
|
||||
@ -1753,7 +1743,4 @@ stop)
|
||||
start)
|
||||
start
|
||||
;;
|
||||
boot)
|
||||
boot
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user