Files
ShellCrash/scripts/libs/set_cron.sh
juewuy 08fc32d63e ~优化vmess入站功能,增加对自定义混淆host的配置存档
~优化Tailscale启用exitnode功能时的文字提示
~增加对无法自动获取lan网段设备的提示信息
~尝试修复部分设备定时任务报错
~尝试调整tun模式下屏蔽quic的防火墙工作机制
~修复重新进入新手引导会覆盖singbox内核为meta内核的bug
~修复公网防火墙放行端口在较新版本openwrt上未生效的bug
2025-12-31 20:44:21 +08:00

25 lines
816 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"
}