mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-04-25 20:10:42 +00:00
~将自动任务的配置文件移动到$CRASHDIR/configs/task目录下
This commit is contained in:
@@ -38,21 +38,21 @@ if [ -n "$test" -o -n "$(pidof CrashCore)" ]; then
|
||||
ckcmd mtd_storage.sh && mtd_storage.sh save >/dev/null 2>&1 #Padavan保存/etc/storage
|
||||
#加载定时任务
|
||||
cronload | grep -v '^$' >"$TMPDIR"/cron_tmp
|
||||
[ -s "$CRASHDIR"/task/cron ] && cat "$CRASHDIR"/task/cron >>"$TMPDIR"/cron_tmp
|
||||
[ -s "$CRASHDIR"/task/running ] && cat "$CRASHDIR"/task/running >>"$TMPDIR"/cron_tmp
|
||||
[ -s "$TASKCFGDIR"/cron ] && cat "$TASKCFGDIR"/cron >>"$TMPDIR"/cron_tmp
|
||||
[ -s "$TASKCFGDIR"/running ] && cat "$TASKCFGDIR"/running >>"$TMPDIR"/cron_tmp
|
||||
[ "$bot_tg_service" = ON ] && echo "* * * * * /bin/sh $CRASHDIR/starts/start_legacy_wd.sh bot_tg #ShellCrash-TG_BOT守护进程" >>"$TMPDIR"/cron_tmp
|
||||
[ "$start_old" = ON ] && echo "* * * * * /bin/sh $CRASHDIR/starts/start_legacy_wd.sh shellcrash #ShellCrash保守模式守护进程" >>"$TMPDIR"/cron_tmp
|
||||
awk '!x[$0]++' "$TMPDIR"/cron_tmp >"$TMPDIR"/cron_tmp2 #删除重复行
|
||||
cronadd "$TMPDIR"/cron_tmp2
|
||||
rm -f "$TMPDIR"/cron_tmp "$TMPDIR"/cron_tmp2
|
||||
#加载条件任务
|
||||
[ -s "$CRASHDIR"/task/afstart ] && { . "$CRASHDIR"/task/afstart; } &
|
||||
[ -s "$CRASHDIR"/task/affirewall -a -s /etc/init.d/firewall -a ! -f /etc/init.d/firewall.bak ] && {
|
||||
[ -s "$TASKCFGDIR"/afstart ] && { . "$TASKCFGDIR"/afstart; } &
|
||||
[ -s "$TASKCFGDIR"/affirewall -a -s /etc/init.d/firewall -a ! -f /etc/init.d/firewall.bak ] && {
|
||||
#注入防火墙
|
||||
line=$(grep -En "fw.* restart" /etc/init.d/firewall | cut -d ":" -f 1)
|
||||
sed -i.bak "${line}a\\. $CRASHDIR/task/affirewall" /etc/init.d/firewall
|
||||
sed -i.bak "${line}a\\. $TASKCFGDIR/affirewall" /etc/init.d/firewall
|
||||
line=$(grep -En "fw.* start" /etc/init.d/firewall | cut -d ":" -f 1)
|
||||
sed -i "${line}a\\. $CRASHDIR/task/affirewall" /etc/init.d/firewall
|
||||
sed -i "${line}a\\. $TASKCFGDIR/affirewall" /etc/init.d/firewall
|
||||
} &
|
||||
exit 0
|
||||
else
|
||||
|
||||
@@ -79,7 +79,7 @@ EOF
|
||||
[ ! -d "$BINDIR"/ui ] && mkdir -p "$BINDIR"/ui
|
||||
[ -z "$crashcore" ] && crashcore=meta
|
||||
#执行条件任务
|
||||
[ -s "$CRASHDIR"/task/bfstart ] && . "$CRASHDIR"/task/bfstart
|
||||
[ -s "$TASKCFGDIR"/bfstart ] && . "$TASKCFGDIR"/bfstart
|
||||
#检查内核配置文件
|
||||
if [ ! -f "$core_config" ]; then
|
||||
if [ -n "$Url" -o -n "$Https" ]; then
|
||||
@@ -144,4 +144,3 @@ fi
|
||||
rm -rf /tmp/ShellCrash/debug.log
|
||||
rm -rf "$CRASHDIR"/debug.log
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ getlanip() { #获取局域网host地址
|
||||
ip -6 addr show dev $iface 2>/dev/null
|
||||
done | grep 'scope global' | awk '{print $2}' | tr '\n' ' ' | sed 's/ $//'
|
||||
)
|
||||
[ -z "$host_ipv6" ] && host_ipv6=$(ip -6 route show | grep -Ev 'default|unreachable|fe80::/|wan|ppp|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet' | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//')
|
||||
[ -z "$host_ipv6" ] && host_ipv6=$(ip -6 route show | grep -Ev 'default|unreachable|fe80::/|wan|ppp|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|multicast|anycast' | awk '{print $1}' | tr '\n' ' ' | sed 's/ $//')
|
||||
}
|
||||
[ -f "$TMPDIR"/ShellCrash.log ] && break
|
||||
[ -n "$host_ipv4" -a "$ipv6_redir" != "ON" ] && break
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#初始化目录
|
||||
[ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd)
|
||||
TASKCFGDIR="$CRASHDIR"/configs/task
|
||||
profile=/etc/profile
|
||||
. "$CRASHDIR"/libs/set_profile.sh
|
||||
. "$CRASHDIR"/libs/set_cron.sh
|
||||
|
||||
Reference in New Issue
Block a user