Files
sxmo-utils/scripts/core/sxmo_rtcwake.sh
Peter John Hartman 611d4b2f44 rtcwake: give its wakelock a uniq id
The worry here is that if we have multiple cron jobs running at the same
time, the first one to exit will remove the lock. (I could be wrong on
this.)

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-03-09 15:33:58 +01:00

23 lines
453 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# shellcheck source=configs/profile.d/sxmo_init.sh
. /etc/profile.d/sxmo_init.sh
. sxmo_common.sh
# We can have multiple cronjobs at the same time
sxmo_wakelock.sh lock executing_cronjob_$$ infinite
sxmo_wakelock.sh unlock waiting_cronjob
finish() {
sxmo_wakelock.sh unlock executing_cronjob_$$
exit 0
}
trap 'finish' TERM INT EXIT
sxmo_log "Running $*"
"$@"