s+ow: many (#53)
* s+ow: many - fix #52: handle SPOW_CRON=n - start sm phase at 59, not after - print failed to get location message - fix usage text indentation * s+ow: lint and format
This commit is contained in:
parent
01c540750a
commit
8fecc090bf
13
s+ow
13
s+ow
|
@ -46,6 +46,11 @@ if [ "$LOCATION_PRIORITISE_NETWORK" = "n" ]; then
|
|||
LOCATION_PRIORITISE_NETWORK=""
|
||||
fi
|
||||
|
||||
# check for cron status
|
||||
if [ "$SPOW_CRON" = "n" ]; then
|
||||
SPOW_CRON=""
|
||||
fi
|
||||
|
||||
# ensure commands exist
|
||||
if ! command -v termux-location >/dev/null 2>&1; then
|
||||
printf "s+ow: error: termux-location is not installed.\ninstall it with 'pkg install termux-api' and with installing the termux:api app from the play store or f-droid.\n"
|
||||
|
@ -251,11 +256,13 @@ run() {
|
|||
for locate_run in 1 2 3; do # run three times in case :p
|
||||
notify "Running termux-location" "$locate_run"
|
||||
|
||||
locate
|
||||
if [ "$locate_run" -gt "1" ]; then
|
||||
LOCATION_TIMEOUT=75 locate
|
||||
fi
|
||||
|
||||
if [ ! -s "$SPOW_LOCTN_OUT" ]; then
|
||||
# erroneous: is empty
|
||||
echo "s+ow: error: failed to get location" >>"$SPOW_SESH_ERR"
|
||||
echo "s+ow: error: failed to get location" | tee -a "$SPOW_SESH_ERR"
|
||||
status=1
|
||||
else
|
||||
# nominal: is not empty
|
||||
|
@ -295,7 +302,7 @@ run() {
|
|||
if [ -n "$SPOW_CRON" ]; then
|
||||
notify "Waiting for the new hour..."
|
||||
printf "waiting until the new hour...\n"
|
||||
while [ "$(date +'%M')" -eq 59 ]; do
|
||||
while [ "$(date +'%M')" -lt 59 ]; do
|
||||
printf " $(date)\n"
|
||||
sleep 1
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue