Skip to content

Commit

Permalink
**v2021.8.23 (202108230)**
Browse files Browse the repository at this point in the history
- -L|--log [cmd] (default cmd: tail -F), djsd generates verbose (/dev/.vr25/djs/djsd.log).
- General fixes
- Major optimizations
- Updated documentation: now with a table of contents and available in HTML format.
  • Loading branch information
VR-25 committed Aug 23, 2021
1 parent 93138fe commit c95d67a
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 41 deletions.
4 changes: 3 additions & 1 deletion META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ echo "


case $installDir in
/data/adb/*) echo "
/data/adb/modules*)
;;
*) echo "
(i) Non-Magisk users can enable $id auto-start by running /data/adb/$domain/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it."
;;
esac
Expand Down
218 changes: 218 additions & 0 deletions README.html

Large diffs are not rendered by default.

51 changes: 38 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Daily Job Scheduler (DJS)



- [DESCRIPTION](#description)
- [LEGAL](#legal)
- [DISCLAIMER](#disclaimer)
- [WARNING](#warning)
- [DONATIONS](#donations)
- [PREREQUISITES](#prerequisites)
- [CONFIGURATION (/data/adb/vr25/djs-data/config.txt)](#configuration-dataadbvr25djs-dataconfigtxt)
- [USAGE](#usage)
- [Terminal Commands](#terminal-commands)
- [NOTES/TIPS FOR FRONT-END DEVELOPERS](#notestips-for-front-end-developers)
- [FREQUENTLY ASKED QUESTIONS (FAQ)](#frequently-asked-questions-faq)
- [LINKS](#links)
- [LATEST CHANGES](#latest-changes)


---
## DESCRIPTION

Expand Down Expand Up @@ -48,7 +64,7 @@ By choosing to use/misuse it, you agree to do so at your own risk!
---
## DONATIONS

Please, support the project with donations (`## LINKS` at the bottom).
Please, support the project with donations ([links](#links) at the bottom).
As the project gets bigger and more popular, the need for coffee goes up as well.


Expand All @@ -70,7 +86,7 @@ Other executables or static binaries can also be placed in /data/adb/vr25/bin/ (


---
## CONFIGURATION (/data/adb/djs-data/config.txt)
## CONFIGURATION (/data/adb/vr25/djs-data/config.txt)

```
// This is a comment line
Expand All @@ -96,7 +112,7 @@ versionCode=201908180
## USAGE


If you feel uncomfortable with the command line, use a `text editor` to modify `/data/adb/djs-data/config.txt`.
If you feel uncomfortable with the command line, use a `text editor` to modify `/data/adb/vr25/djs-data/config.txt`.
Changes to this file take effect almost instantly, and without a [daemon](https://en.wikipedia.org/wiki/Daemon_(computing)) restart.


Expand All @@ -110,15 +126,18 @@ Usage: djsc|djs-config OPTION ARGS
-a|--append 'LINE'
e.g., djsc -a 2200 reboot -p
-d|--delete 'PATTERN' (all matching lines)
-d|--delete ['regex'] (deletes all matching lines)
e.g., djsc --delete 2200
-e|--edit EDITOR OPTS (fallback: nano -l|vim|vi)
-e|--edit [cmd] (fallback cmd: nano -l|vim|vi)
e.g., djs-config --edit vim
-l|--list 'PATTERN' (default ".", meaning "all lines")
-l|--list ['regex'] (fallback regex: ".", matches all lines)
e.g., djsc -l '^boot'
-L|--log [cmd] (fallback cmd: tail -F)
e.g., djsc -L cat > /sdcard/djsd.log
Daemon Management
Expand Down Expand Up @@ -165,6 +184,11 @@ Explain settings/concepts as clearly and with as few words as possible.
Open issues on GitHub or contact the developer on Telegram/XDA (linked below). Always provide as much information as possible.


> Where do I find daemon logs?
`/dev/.vr25/djs/djsd.log`


---
## LINKS

Expand All @@ -181,13 +205,6 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A
## LATEST CHANGES


**v2021.7.28 (202107280)**

- Fixed issues.
- Major refactoring
- Updated framework and documentation.


**v2021.8.2 (202108020)**

- Fixed AccA related issues.
Expand All @@ -197,3 +214,11 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A

- Rewritten daemon logic for better efficiency and reliability.
- Updated documentation


**v2021.8.23 (202108230)**

- -L|--log [cmd] (default cmd: tail -F), djsd generates verbose (/dev/.vr25/djs/djsd.log).
- General fixes
- Major optimizations
- Updated documentation: now with a table of contents and available in HTML format.
4 changes: 3 additions & 1 deletion customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ echo "


case $installDir in
/data/adb/*) echo "
/data/adb/modules*)
;;
*) echo "
(i) Non-Magisk users can enable $id auto-start by running /data/adb/$domain/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it."
;;
esac
Expand Down
21 changes: 18 additions & 3 deletions djs/djs-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ if [ -f $config ]; then
echo
grep -E "${*:-.}" $config | grep -v '^$'
;;

-L|--log)
shift
echo
log=/dev/.vr25/djs/djsd.log
if [ -z "${1-}" ]; then
tail -F $log
else
eval "$@ $log"
fi
echo
;;
*)
cat << CAT
Expand All @@ -50,15 +62,18 @@ Usage: djsc|djs-config OPTION ARGS
-a|--append 'LINE'
e.g., djsc -a 2200 reboot -p
-d|--delete 'PATTERN' (all matching lines)
-d|--delete ['regex'] (deletes all matching lines)
e.g., djsc --delete 2200
-e|--edit EDITOR OPTS (fallback: nano -l|vim|vi)
-e|--edit [cmd] (fallback cmd: nano -l|vim|vi)
e.g., djs-config --edit vim
-l|--list 'PATTERN' (default ".", meaning "all lines")
-l|--list ['regex'] (fallback regex: ".", matches "all lines")
e.g., djsc -l '^boot'
-L|--log [cmd] (fallback cmd: tail -F)
e.g., djsc -L cat > /sdcard/djsd.log
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.
Expand Down
44 changes: 24 additions & 20 deletions djs/djs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
# Copyright (C) 2019-2021, VR25
# License: GPLv3+


exec > /dev/null 2>&1

set -u
tmpDir=/dev/.vr25/djs
log=$tmpDir/djsd.log
execDir=/data/adb/vr25/djs
config=${execDir}-data/config.txt
getv() { grep -E "$1" $config 2>/dev/null; }

# verbose
[ -z "$LINENO" ] || export PS4='$LINENO: '
echo "###$(date)###" >> $log
echo "versionCode=$(sed -n s/versionCode=//p $execDir/module.prop 2>/dev/null)" >> $log
exec >> $log 2>&1
set -x

[ -f $execDir/disable ] && exit 0
. $execDir/setup-busybox.sh
pgrep -f /djs.sh | sed s/$$// | xargs kill -9 2>/dev/null
mkdir -p $tmpDir

if [ ! -f $config ]; then
mkdir -p ${config%/*}
cp $execDir/default-config.txt $config
cat $execDir/default-config.txt > $config
fi


Expand Down Expand Up @@ -71,30 +75,30 @@ ln -sf $execDir/djs-version.sh /dev/djs-version


# boot schedules
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 --
if [ ! -f $tmpDir/djsd-boot.sh ]; then
echo "#!/system/bin/sh" > $tmpDir/djsd-boot.sh
grep '^boot | : --boot' $config | sed 's/^.... //' >> $tmpDir/djsd-boot.sh
echo 'exit $?' >> $tmpDir/djsd-boot.sh
chmod u+x $tmpDir/djsd-boot.sh
start-stop-daemon -bx $tmpDir/djsd-boot.sh -S --
grep -q '^boot .* : --delete' $config && sed -i '/^boot .* : --delete/d' $config
fi

# HH:MM schedules
while :; do
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 --
script=$tmpDir/djsd-${time}.sh
if [ ! -f $script ] && grep -q "^$time " $config; then
sed -n "s|^$time |#!/system/bin/sh\n|p" $config > $script
echo 'rm $0; exit $?' >> $script
chmod u+x $script
grep -q ' : --delete' $script && sed -i "/^$time .* : --delete/d" $config
start-stop-daemon -bx $script -S --
fi
sleep 40
while [ $(date +%H%M) -eq $time ]; do
sleep 10
sleep 20
done
[ $(du -k $log | cut -f1) -ge 8 ] && : > $log
done

exit $?
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ echo "


case $installDir in
/data/adb/*) echo "
/data/adb/modules*)
;;
*) echo "
(i) Non-Magisk users can enable $id auto-start by running /data/adb/$domain/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it."
;;
esac
Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=djs
name=Daily Job Scheduler (DJS)
version=v2021.8.9.1
versionCode=202108091
version=v2021.8.23
versionCode=202108230
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.

0 comments on commit c95d67a

Please sign in to comment.