Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

termux-location sometimes returns no output when ran in crontab #719

Open
igorzhilin opened this issue Oct 11, 2024 · 1 comment
Open

termux-location sometimes returns no output when ran in crontab #719

igorzhilin opened this issue Oct 11, 2024 · 1 comment

Comments

@igorzhilin
Copy link

Problem description

When running script via crontab, it sometimes writes empty files, even with retries. When running via bash while being at the same geolocation, it writes a file as expected.

Script save-location.sh:

retries=5
path="$HOME/location"
filename=$(date +'%Y-%m-%d_%H-%M-%S').json
fullpath="$path/$filename"

touch "$fullpath"

while [[ ! -s "$fullpath" && "$retries" -ne 0 ]]; do
  termux-location > "$fullpath"
  ((retries--))
done

When executed via bash save-location.sh, it writes the termux location to the file.

When running as a crontab job

*/1 * * * * bash ~/git/linux/android/save-location/save-location.sh 

then some of the files are empty, some are populated.

Steps to reproduce

pkg in cronie
mkdir ~/location
crontab -e
# edit in editor
*/1 * * * * bash <full path to save-location.sh>
# it will run every 1 minute
# save

Look into ~/location. Some of the files will be empty, some will contain the location json.

Expected behavior

All files contain termux location json.

Additional information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=17942
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.quantum5.ca/termux/termux-main stable main
Updatable packages:
c-ares/stable 1.34.1 aarch64 [upgradable from: 1.33.1]
glib/stable 2.80.5-2 aarch64 [upgradable from: 2.80.5-1]
tree-sitter/stable 0.24.3 aarch64 [upgradable from: 0.24.2]
termux-tools version:
1.43.6
Android version:
14
Kernel build information:
Linux localhost 6.1.43-android14-11 #1 SMP PREEMPT Mon Aug 26 02:08:56 UTC 2024 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A556B
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.window versionCode:15
com.termux.widget versionCode:13
com.termux.nix versionCode:188036
com.termux.styling versionCode:1000
com.termux.api versionCode:51
com.termux.boot versionCode:1000
@igorzhilin
Copy link
Author

Maybe this is still due to the geolocation that termux-location cannot determine... This, however, contradicts my tests running directly from bash. Ultimately, I need a way to make sure termux-location succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant