Improved geox updates and subscriptions

the renewal intervals for geox/subscribe are separate and executed geox/subscribe.
  # su -c /data/adb/box/scripts/box.tool subs
  # su -c /data/adb/box/scripts/box.tool geox
This commit is contained in:
taamarin
2023-06-08 15:42:42 +07:00
parent 81b27b00c4
commit d55c8290b0
3 changed files with 19 additions and 12 deletions

View File

@@ -22,8 +22,10 @@ delete_logs() {
crontab_geo() {
if [[ "${auto_update_geox}" != "false" || "${auto_update_subscription}" != "false" ]]; then
echo "${update_interval} ${scripts_dir}/box.tool subgeo" >> "${run_path}/root"
log debug "Interval crontab geo and subscription (${update_interval})."
echo "${update_interval_geox} ${scripts_dir}/box.tool geox" >> "${run_path}/root"
echo "${update_interval_subs} ${scripts_dir}/box.tool subs" >> "${run_path}/root"
log debug "Interval crontab geox (${update_interval_geox})."
log debug "Interval crontab subscription (${update_interval_subs})."
log debug "${bin_name} geox (${auto_update_geox})."
if [ "${bin_name}" = "clash" ]; then
log debug "${bin_name} subscription (${auto_update_subscription})."

View File

@@ -194,7 +194,7 @@ update_subgeo() {
if [ -f "${update_file_name}.bak" ]; then
rm ${update_file_name}.bak
fi
flag=false # if it's true, after the update is complete it will restart BFM, but to update proxy_provider you don't need to restart it, just reload it on the dashboard/yacd
flag=true # if it's true, after the update is complete it will restart BFM, but to update proxy_provider you don't need to restart it, just reload it on the dashboard/yacd
else
log error "subscription failed"
fi
@@ -509,14 +509,19 @@ case "$1" in
port)
port_detection
;;
reload)
reload)
reload
;;
subgeo)
geox)
auto_update_subscription="false"
update_subgeo
find "${data_dir}/${bin_name}" -type f -name "*.db.bak" -delete
find "${data_dir}/${bin_name}" -type f -name "*.dat.bak" -delete
;;
subs)
auto_update_geox="false"
update_subgeo
;;
all)
for list in "${bin_list[@]}" ; do
bin_name="${list}"
@@ -526,7 +531,7 @@ case "$1" in
done
;;
*)
echo "$0: usage: $0 {reload|testing|keepdns|connect|upyacd|upcore|cgroup|port|subgeo|all}"
echo "$0: usage: $0 {reload|testing|keepdns|connect|upyacd|upcore|cgroup|port|geox|subs|all}"
exit 1
;;
esac
esac

View File

@@ -42,15 +42,15 @@ ap_list=( "softap+" "wlan+" "swlan+" "ap+" "rndis+" )
# Ignore AP in the out list
ignore_out_list=()
# Update subscription & geox
# Set update interval using cron, for more information: https://crontab.guru/
# Type "su -c /data/adb/box/scripts/box.tool geox" to update geox
crontab_sec="false"
update_interval="0 12 */3 * *" # updates will run at 12 noon every three days.
# Update sub&geo
# Type "su -c /data/adb/box/scripts/box.tool subgeo" to update
update_interval_geox="0 12 */3 * *" # updates will run at 12 noon every three days.
auto_update_geox="true"
# Only update clash subscription URL
# Type "su -c /data/adb/box/scripts/box.tool subs" to update subscription / Only update clash subscription URL
update_interval_subs="0 0 * * *" # every 12 p.m
auto_update_subscription="false"
subscription_url=""