mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-06 03:14:22 +08:00
update 2026-10-07 11:52:44
This commit is contained in:
1 parent
d6cc6efa77
commit
617f7ca2a6
4898 files changed
-1713675
No files matched your search
@@ -1,3 +0,0 @@
|
||||
|
||||
config basic
|
||||
option enable '0'
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
# Copyright (C) 2016 fw867 <ffkykzs@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
START=99
|
||||
|
||||
CONFIG="luci-app-control-timewol"
|
||||
|
||||
uci_get_by_type() {
|
||||
local index=0
|
||||
if [ -n $4 ]; then
|
||||
index=$4
|
||||
fi
|
||||
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
is_true() {
|
||||
case $1 in
|
||||
1|on|true|yes|enabled) echo 0;;
|
||||
*) echo 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
load_config() {
|
||||
ENABLED=$(uci_get_by_type basic enable)
|
||||
return $(is_true $ENABLED)
|
||||
}
|
||||
|
||||
add_rule(){
|
||||
local items=$(uci show ${CONFIG} | grep "=macclient" | cut -d '.' -sf 2 | cut -d '=' -sf 1)
|
||||
for i in $items; do
|
||||
local macaddr=$(uci -q get ${CONFIG}.${i}.macaddr)
|
||||
local maceth=$(uci -q get ${CONFIG}.${i}.maceth)
|
||||
local minute=$(uci -q get ${CONFIG}.${i}.minute)
|
||||
local hour=$(uci -q get ${CONFIG}.${i}.hour)
|
||||
local day=$(uci -q get ${CONFIG}.${i}.day)
|
||||
local month=$(uci -q get ${CONFIG}.${i}.month)
|
||||
local weeks=$(uci -q get ${CONFIG}.${i}.weeks)
|
||||
if [ -z $macaddr ] || [ -z $maceth ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -z $minute ] ; then
|
||||
minute="0"
|
||||
fi
|
||||
if [ -z $hour ] ; then
|
||||
hour="*"
|
||||
fi
|
||||
if [ -z $day ] ; then
|
||||
day="*"
|
||||
fi
|
||||
if [ -z $month ] ; then
|
||||
month="*"
|
||||
fi
|
||||
if [ -z $weeks ] ; then
|
||||
weeks="*"
|
||||
fi
|
||||
echo "$minute $hour $day $month $weeks /usr/bin/etherwake -D -i $maceth $macaddr" >> /etc/crontabs/root
|
||||
unset macaddr maceth minute hour day month weeks
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
stop
|
||||
! load_config && exit 0
|
||||
add_rule
|
||||
}
|
||||
stop() {
|
||||
sed -i '/etherwake/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-control-timewol": {
|
||||
"description": "Grant UCI access for luci-app-control-timewol",
|
||||
"read": {
|
||||
"uci": [ "luci-app-control-timewol" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "luci-app-control-timewol" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "luci-app-control-timewol",
|
||||
"init": "luci-app-control-timewol"
|
||||
}
|
||||
Reference in new issue
Block a user