mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-04-26 20:51:15 +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
|
||||
|
||||
Reference in New Issue
Block a user