mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-11 07:51:45 +00:00
~优化Tailscale启用exitnode功能时的文字提示 ~增加对无法自动获取lan网段设备的提示信息 ~尝试修复部分设备定时任务报错 ~尝试调整tun模式下屏蔽quic的防火墙工作机制 ~修复重新进入新手引导会覆盖singbox内核为meta内核的bug ~修复公网防火墙放行端口在较新版本openwrt上未生效的bug
25 lines
816 B
Bash
25 lines
816 B
Bash
|
||
crondir="$(crond -h 2>&1 | grep -oE 'Default:.*' | awk -F ":" '{print $2}')"
|
||
[ ! -w "$crondir" ] && crondir="/etc/storage/cron/crontabs"
|
||
[ ! -w "$crondir" ] && crondir="/var/spool/cron/crontabs"
|
||
[ ! -w "$crondir" ] && crondir="/var/spool/cron"
|
||
tmpcron="$TMPDIR"/cron_tmp
|
||
|
||
croncmd() { #定时任务工具
|
||
if [ -w "$crondir" ]; then
|
||
[ "$1" = "-l" ] && cat "$crondir"/"$USER"
|
||
[ -f "$1" ] && cat "$1" >"$crondir"/"$USER"
|
||
else
|
||
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
|
||
fi
|
||
}
|
||
cronset() { #定时任务设置
|
||
# 参数1代表要移除的关键字,参数2代表要添加的任务语句
|
||
croncmd -l >"$tmpcron"
|
||
sed -i "/$1/d" "$tmpcron"
|
||
sed -i '/^$/d' "$tmpcron"
|
||
echo "$2" >>"$tmpcron"
|
||
croncmd "$tmpcron"
|
||
rm -f "$tmpcron"
|
||
}
|