Skip to content

Commit

Permalink
add choose update time
Browse files Browse the repository at this point in the history
  • Loading branch information
zxlhhyccc authored and pymumu committed Oct 22, 2023
1 parent 37a87e8 commit 62171f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package/openwrt/files/etc/init.d/smartdns
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ disable_auto_update()

enable_auto_update()
{
grep "0 5 * * * /etc/init.d/smartdns updatefiles" /etc/crontabs/root 2>/dev/null
grep "0 $auto_update_day_time * * * /etc/init.d/smartdns updatefiles" /etc/crontabs/root 2>/dev/null
if [ $? -eq 0 ]; then
return
fi

disable_auto_update 1
echo "0 5 * * * /etc/init.d/smartdns updatefiles" >> /etc/crontabs/root
echo "0 $auto_update_day_time * * * /etc/init.d/smartdns updatefiles" >> /etc/crontabs/root
restart_crond
}

Expand Down Expand Up @@ -498,6 +498,8 @@ load_service()
config_get tcp_server "$section" "tcp_server" "1"
config_get server_flags "$section" "server_flags" ""

config_get auto_update_day_time "$section" "auto_update_day_time" "5"

config_get speed_check_mode "$section" "speed_check_mode" ""
[ ! -z "$speed_check_mode" ] && conf_append "speed-check-mode" "$speed_check_mode"

Expand Down

5 comments on commit 62171f2

@jxph1123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能否增加每周或者每月更新选项。

@zxlhhyccc
Copy link
Contributor Author

@zxlhhyccc zxlhhyccc commented on 62171f2 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能否增加每周或者每月更新选项。

我开始是加了的,后来大佬说没必要,你可以看我前面提交的pr。。。。
#1499

@jxph1123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能否增加每周或者每月更新选项。

我开始是加了的,后来大佬说没必要,你可以看我前面提交的pr。。。。 #1499

其实这个规则更新个人认为每周一次就行了,毕竟每天变化不大

@zxlhhyccc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能否增加每周或者每月更新选项。

我开始是加了的,后来大佬说没必要,你可以看我前面提交的pr。。。。 #1499

其实这个规则更新个人认为每周一次就行了,毕竟每天变化不大

你可以比照修改咯。。。

@jxph1123
Copy link

@jxph1123 jxph1123 commented on 62171f2 Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最简单的,我自己弄了个patch,改成每周更新了。

--- a/package/openwrt/files/etc/init.d/smartdns
+++ b/package/openwrt/files/etc/init.d/smartdns
@@ -262,10 +262,10 @@ enable_auto_update()
 {
-	grep "0 $auto_update_day_time * * * /etc/init.d/smartdns updatefiles" /etc/crontabs/root 2>/dev/null
+	grep "0 $auto_update_day_time * * 1 /etc/init.d/smartdns updatefiles" /etc/crontabs/root 2>/dev/null
	if [ $? -eq 0 ]; then
		return 
	fi

	disable_auto_update 1
-	echo "0 $auto_update_day_time * * * /etc/init.d/smartdns updatefiles" >> /etc/crontabs/root
+	echo "0 $auto_update_day_time * * 1 /etc/init.d/smartdns updatefiles" >> /etc/crontabs/root
	restart_crond
 }

Please sign in to comment.