Skip to content

Failing to start block when waking from sleep #52

Description

@gcohara

Hi,

Upon waking the computer, often the block fails to start.
This occurs when the computer went to sleep during a previous block - for instance, if the computer went to sleep during a block from 9pm to 7am, and is then woken during a block from 9am to 6pm.
Looking at the syslog, I found the following:

Aug 13 10:46:45 georges-mbp Auto-SelfControl: 
[ERROR] SelfControl is already running, ignore current execution of Auto-SelfControl.

Aug 13 10:46:45 georges-mbp com.apple.xpc.launchd[1] (com.parrot-bytes.auto-selfcontrol[73333]): 
Service exited with abnormal code: 2

It seems that upon wakeup the auto-selfcontrol script is run before the SelfControl daemon has a chance to clear itself.

It doesn't seem that the macOS launchctl utility has many options for starting daemons at a delay after wakeup etc, so I went for the simple solution of putting

time.sleep(1)

in the main function for the script.
This should hopefully give the SelfControl daemon time to remove itself.

Possibly you might want a more elegant solution, but if it works I'll submit a PR anyway.

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