termux / termux/termux-api-package
termux-job-scheduler: New jobs default to job ID 0
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 1.7k
- Forks
- 523
- PR merge metrics
- No merged PRs in 30d
Description
Problem description
When creating a new job, with no ID given it assumes ID 0 and replaces an existing job of that ID.
Steps to reproduce
$ termux-job-scheduler -s ~/jobs/one.sh --period-ms 14400000
Scheduling Job 0: /data/data/com.termux/files/home/jobs/one.sh (periodic: 14400000ms) ... - response 1
$ termux-job-scheduler -s ~/jobs/two.sh --period-ms 14400000
Scheduling Job 0: /data/data/com.termux/files/home/jobs/two.sh (periodic: 14400000ms) ... - response 1
Expected behavior
I'd expect the default behaviour to choose the next available job number and not replace an existing job.
--job-id int job id (will overwrite any previous job with the same id)
This reads to me like it will override a job only if you explicitly give it an existing job ID (it doesn't specify a default of 0).
Additional information
$ termux-info
Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://grimler.se/termux/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.31.0
Android version:
12
Kernel build information:
Linux localhost 4.19.157-perf+ #1 SMP PREEMPT Sat Sep 17 00:13:28 CST 2022 aarch64 Android
Device manufacturer:
OnePlus
Device model:
EB2103
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the termux-job-scheduler command entry point and reproduce the two scheduling commands shown in the issue. Trace how an omitted --job-id is handled and verify the behavior when multiple jobs are created without explicit IDs. Done means a new job receives the next available ID instead of replacing job 0, while an explicitly supplied existing ID still overwrites that job.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100