@@ -9,19 +9,22 @@ scripts_dir="${0%/*}"
99source /data/adb/box/settings.ini
1010
1111PROPFILE=" /data/adb/modules/box_for_root/module.prop"
12+ log_backup=" false"
1213
1314box_check_logs () {
1415 ts=$( date ' +%Y-%m-%d_%H-%M-%S' )
1516 log Info " Cleaning and backing up logs"
1617
1718 # Backup logs for each bin in bin_list
18- for bin in " ${bin_name} " ; do
19- log_file=" ${box_run} /${bin} .log"
20- if [ -f " ${log_file} " ]; then
21- mv " ${log_file} " " ${box_run} /${bin} _$ts .log.bak"
22- log Info " Backup: ${bin} .log → ${bin} _${ts} .log.bak"
23- fi
24- done
19+ if [ " ${log_backup} " = " true" ]; then
20+ for bin in " ${bin_name} " ; do
21+ log_file=" ${box_run} /${bin} .log"
22+ if [ -f " ${log_file} " ]; then
23+ mv " ${log_file} " " ${box_run} /${bin} _$ts .log.bak"
24+ log Info " Backup: ${bin} .log → ${bin} _${ts} .log.bak"
25+ fi
26+ done
27+ fi
2528
2629 # Remove specific unnecessary files
2730 find " ${box_run} " -maxdepth 1 -type f \( -name " root" -o -name " *.list" -o -name " *.inotify.log" \) -exec rm -f {} +
@@ -208,7 +211,7 @@ prepare_singbox() {
208211 "auto_route": true,
209212 "strict_route": true,
210213 "auto_redirect": true,
211- "include_android_user": [0,10],
214+ "include_android_user": [0,10,999 ],
212215 "include_package": [],
213216 "exclude_package": []
214217 }]' -i --output-format=json " ${sing_config} "
@@ -334,7 +337,7 @@ prepare_clash() {
334337 ' strict-route: true' \
335338 ' auto-redirect: true' \
336339 ' auto-detect-interface: true' \
337- ' include-android-user: [0, 10]' \
340+ ' include-android-user: [0, 10, 999 ]' \
338341 ' exclude-package: []' \
339342 ' include-package: []' \ >> " ${clash_config} "
340343 log Debug " [tun] configuration has been added to ${clash_config} "
@@ -440,8 +443,8 @@ box_run_bin() {
440443 ;;
441444 sing-box)
442445 prepare_singbox
443- if ${bin_path} check -D " ${box_dir} /${bin_name} " -C " ${box_dir} / ${bin_name }" > " ${box_run} /${bin_name} .log" 2>&1 ; then
444- nohup busybox setuidgid " ${box_user_group} " " ${bin_path} " run -D " ${box_dir} /${bin_name} " -C " ${box_dir} / ${bin_name }" > " ${bin_log} " 2>&1 &
446+ if ${bin_path} check -D " ${box_dir} /${bin_name} " -c " ${sing_config } " > " ${box_run} /${bin_name} .log" 2>&1 ; then
447+ nohup busybox setuidgid " ${box_user_group} " " ${bin_path} " run -D " ${box_dir} /${bin_name} " -c " ${sing_config } " > " ${bin_log} " 2>&1 &
445448 PID=$!
446449 echo -n $PID > " ${box_pid} "
447450 sleep 1
0 commit comments