Skip to content

Commit 666646a

Browse files
pimsierhuisxalexalex
authored andcommitted
termux-job-scheduler: Add --persisted option, see termux/termux-api#316
1 parent ab18640 commit 666646a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/termux-job-scheduler

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ show_usage () {
1818
echo " --battery-not-low boolean run only when battery is not low, default true (at least Android O)"
1919
echo " --storage-not-low boolean run only when storage is not low, default false (at least Android O)"
2020
echo " --charging boolean run only when charging, default false"
21+
echo " --persisted boolean should the job survive reboots, default false"
2122
echo " --trigger-content-uri text (at least Android N)"
2223
echo " --trigger-content-flag int default 1, (at least Android N)"
2324
exit 0
@@ -34,6 +35,7 @@ OPT_NETWORK=""
3435
OPT_BATTERY_NOT_LOW=""
3536
OPT_STORAGE_NOT_LOW=""
3637
OPT_CHARGING=""
38+
OPT_PERSISTED=""
3739
OPT_TRIGGER_CONTENT_URI=""
3840
OPT_TRIGGER_CONTENT_FLAG=""
3941

@@ -45,7 +47,7 @@ job-id:,pending,\
4547
cancel,cancel-all,\
4648
period-ms:,network:,\
4749
battery-not-low:,storage-not-low:,\
48-
charging:,help,\
50+
charging:,persisted:,help,\
4951
trigger_content_flag:,trigger-content-uri: \
5052
-s bash \
5153
-- "$@"`
@@ -63,6 +65,7 @@ while true; do
6365
--battery-not-low) OPT_BATTERY_NOT_LOW="$2"; shift 2;;
6466
--storage-not-low) OPT_STORAGE_NOT_LOW="$2"; shift 2;;
6567
--charging) OPT_CHARGING="$2"; shift 2;;
68+
--persisted) OPT_PERSISTED="$2"; shift 2;;
6669
--trigger-content-flag) OPT_TRIGGER_CONTENT_FLAG="$2"; shift 2;;
6770
--trigger-content-uri) OPT_TRIGGER_CONTENT_URI="$2"; shift 2;;
6871
-h | --help) show_usage;;
@@ -83,6 +86,7 @@ if [ -n "$OPT_NETWORK" ]; then set -- "$@" --es network "$OPT_NETWORK"; fi
8386
if [ -n "$OPT_BATTERY_NOT_LOW" ]; then set -- "$@" --ez battery_not_low "$OPT_BATTERY_NOT_LOW"; fi
8487
if [ -n "$OPT_STORAGE_NOT_LOW" ]; then set -- "$@" --ez storage_not_low "$OPT_STORAGE_NOT_LOW"; fi
8588
if [ -n "$OPT_CHARGING" ]; then set -- "$@" --ez charging "$OPT_CHARGING"; fi
89+
if [ -n "$OPT_PERSISTED" ]; then set -- "$@" --ez persisted "$OPT_PERSISTED"; fi
8690
if [ -n "$OPT_TRIGGER_CONTENT_URI" ]; then set -- "$@" --es trigger_content_uri "$OPT_TRIGGER_CONTENT_URI"; fi
8791
if [ -n "$OPT_TRIGGER_CONTENT_FLAG" ]; then set -- "$@" --ez trigger_content_flag "$OPT_TRIGGER_CONTENT_FLAG"; fi
8892

0 commit comments

Comments
 (0)