From d55c8290b0dee5c1249c74ea760683add8e0a225 Mon Sep 17 00:00:00 2001 From: taamarin Date: Thu, 8 Jun 2023 15:42:42 +0700 Subject: [PATCH] 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 --- box/scripts/box.service | 6 ++++-- box/scripts/box.tool | 15 ++++++++++----- box/settings.ini | 10 +++++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/box/scripts/box.service b/box/scripts/box.service index d37a069..b26b8cf 100755 --- a/box/scripts/box.service +++ b/box/scripts/box.service @@ -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})." diff --git a/box/scripts/box.tool b/box/scripts/box.tool index 57d99d5..ae72d34 100755 --- a/box/scripts/box.tool +++ b/box/scripts/box.tool @@ -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 \ No newline at end of file diff --git a/box/settings.ini b/box/settings.ini index 618b440..5298dbd 100755 --- a/box/settings.ini +++ b/box/settings.ini @@ -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=""