Skip to content

Feature request - S3 Sleep: allow pre-run script to abort sleep via exit code #111

Description

@mdunaiski

Currently the preRun script is executed in pre_sleep_activity(), but its exit code is ignored, so sleep always continues.
It would be useful if a non-zero exit status could prevent sleep until the next scheduled run/check.

Something like this may work:

pre_sleep_activity() {
...
if [[ -x $preRun ]]; then
  log "Execute custom commands before sleep"

  if ! "$preRun"; then
    log "Pre-sleep script returned a failure status. Aborting sleep."
    return 1
  fi
fi
system_sleep() {
# Do pre-sleep activities
  if ! pre_sleep_activity; then
    log "Sleep cancelled by pre-sleep script."
    return 1
  fi
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions