View Single Post
Old 05-11-2024, 01:08 AM   #2
neil_swann80
0000000000101010
neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.neil_swann80 ought to be getting tired of karma fortunes by now.
 
neil_swann80's Avatar
 
Posts: 5,894
Karma: 12981955
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
If your device is ezdiy rooted, you can create a .sh startup script in:
/mnt/ext1/system/init.d

If not rooted you could add this to a launcher .app file for a frequently used app.

By default it creates a new global.cfg file as soon as the ask_connect_ts timestamp crosses 12 days.

Code:
#!/bin/sh

# Threshold to run - days x seconds_in_24hrs (needs to be less than 14 days)
daySecs=$((12*86400))
# current unix timestamp
utime=$(date +%s)
# current unix timestamp minus threshold
u2time=$(($utime-$daySecs))

# read ask_connect_ts timestamp from config file
eval $(grep "^ask_connect_ts=" /mnt/ext1/system/config/global.cfg)
# If timestamp is not yet 12 days old script exits
if [ $ask_connect_ts -gt $u2time ]; then
  exit
fi

# sleep only needed if running as startup script
# allow startup process to finish with file before editing 
sleep 15

# create new global.cfg file with new ask_connect_ts value
rm -f /mnt/ext1/system/config/global.cfg.back
mv /mnt/ext1/system/config/global.cfg /mnt/ext1/system/config/global.cfg.old
echo "" > /mnt/ext1/system/config/global.cfg
IFS=''; cat "/mnt/ext1/system/config/global.cfg.old" |
while read data; do
   if echo "$data" | grep -q "ask_connect_ts"; then 
	echo "ask_connect_ts=$utime" >> "/mnt/ext1/system/config/global.cfg"
   else echo "${data}" >> "/mnt/ext1/system/config/global.cfg"; fi
done
cp /mnt/ext1/system/config/global.cfg /mnt/ext1/system/config/global.cfg.back
rm -f /mnt/ext1/system/config/global.cfg.old

exit

Last edited by neil_swann80; 06-07-2024 at 04:58 AM.
neil_swann80 is offline   Reply With Quote