diff --git a/README.md b/README.md index acf008c..e61689a 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,9 @@ Notes - All commands return either 0 (success/running) or 1 (failure/stopped). - djs-status prints the daemon's process ID (PID). - Special shell characters (e.g., "|", ";", "&") must be quoted or escaped. For the sake of simplicity and consistency, single-quote all arguments as a whole (e.g., djsc -a '2200 reboot -p'). +- PATH starts with /data/adb/vr25/bin:/dev/.vr25/busybox. +This means schedules don't require additional busybox setup. +The first directory holds user executables. ``` --- @@ -178,23 +181,6 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A ## LATEST CHANGES -**v2019.10.18 (201910180)** - -- `: --boot` and `: --delete` flags -- Attribute back-end files ownership to front-end app -- Automatically copy installation log to /files/logs/ -- Back-end can be upgraded from Magisk Manager, EX/FK Kernel Manager, and similar apps -- `bundle.sh` - bundler for front-end app -- `djs-version`: prints `versionCode` (integer) -- Fixed schedule deletion and busybox handling issues -- Flashable uninstaller: `/sdcard/djs-uninstaller.zip` -- Major optimizations -- Prioritize `nano -l` for text editing -- Richer installation and initialization logs (/data/adb/djs-data/logs/) -- Updated `build.sh` and documentation -- Workaround for front-end autostart blockage (Magisk service.d script) - - **v2021.7.28 (202107280)** - Fixed issues. @@ -205,3 +191,9 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A **v2021.8.2 (202108020)** - Fixed AccA related issues. + + +**v2021.8.9.1 (202108091)** + +- Rewritten daemon logic for better efficiency and reliability. +- Updated documentation diff --git a/djs/djs-config.sh b/djs/djs-config.sh index 022b27b..e54914b 100644 --- a/djs/djs-config.sh +++ b/djs/djs-config.sh @@ -58,6 +58,10 @@ Usage: djsc|djs-config OPTION ARGS -l|--list 'PATTERN' (default ".", meaning "all lines") e.g., djsc -l '^boot' + +Note: PATH starts with /data/adb/vr25/bin:/dev/.vr25/busybox. +This means schedules don't require additional busybox setup. +The first directory holds user executables. CAT ;; esac diff --git a/djs/djs.sh b/djs/djs.sh index 94a2717..7de2de1 100644 --- a/djs/djs.sh +++ b/djs/djs.sh @@ -7,7 +7,6 @@ exec > /dev/null 2>&1 set -u -IFS=$(printf '\t\n') tmpDir=/dev/.vr25/djs execDir=/data/adb/vr25/djs config=${execDir}-data/config.txt @@ -72,27 +71,30 @@ ln -sf $execDir/djs-version.sh /dev/djs-version # boot schedules -for schedule in $(getv '^boot | : --boot'); do - if ! grep -q "$schedule" $tmpDir/boot 2>/dev/null; then - echo "$schedule" >> $tmpDir/boot - (unset IFS; set +u; eval "$(echo "$schedule" | sed 's#^.... ##')" &) & - fi -done +if [ ! -f $tmpDir/boot.sh ]; then + echo "#!/system/bin/sh" > $tmpDir/boot.sh + grep '^boot | : --boot' $config | sed 's/^.... //' >> $tmpDir/boot.sh + echo 'exit $?' >> $tmpDir/boot.sh + chmod u+x $tmpDir/boot.sh + start-stop-daemon -bx $tmpDir/boot.sh -S -- + grep -q '^boot .* : --delete' $config && sed -i '/^boot .* : --delete/d' $config +fi +# HH:MM schedules while :; do - # HH:MM schedules - for schedule in $(getv '^[0-2].[0-5][0-9]'); do - if [ $(date +%H%M) -eq $(echo "$schedule" | grep -o '^.... ') ]; then - if ! grep -q "$schedule" $tmpDir/HH:MM 2>/dev/null; then - echo "$schedule" >> $tmpDir/HH:MM - (unset IFS; set +u; eval "$(echo "$schedule" | sed 's#^.... ##')" &) & - (sleep 60; sed -i "\#$schedule#d" $tmpDir/HH:MM &) & - echo "$schedule" | grep -q ' : --delete' && sed -i "\#$schedule#d" $config - sleep 1 - fi - fi + time=$(date +%H%M) + echo "#!/system/bin/sh" > $tmpDir/${time}.sh + if grep "^$time " $config | sed 's/^.... //' >> $tmpDir/${time}.sh; then + echo 'rm $0' >> $tmpDir/${time}.sh + echo 'exit $?' >> $tmpDir/${time}.sh + chmod u+x $tmpDir/${time}.sh + grep -q ' : --delete' $tmpDir/${time}.sh && sed -i "/^$time .* : --delete/d" $config + start-stop-daemon -bx $tmpDir/${time}.sh -S -- + fi + sleep 40 + while [ $(date +%H%M) -eq $time ]; do + sleep 10 done - sleep 20 done exit $? diff --git a/module.prop b/module.prop index 6d1000a..3032c3f 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=djs name=Daily Job Scheduler (DJS) -version=2021.8.2 -versionCode=202108020 +version=v2021.8.9.1 +versionCode=202108091 author=VR25 description=Runs commands and scripts on boot and at HH:MM. Any root solution is supported. The installation is always "system-less", whether or not the system is rooted with Magisk.