I'm using Self Control to block distractions, and I'm trying to run it daily using the OSX launchd utility with the Launch Control GUI. This calls a script that figures out the amount of time to block then starts Self Control for that amount of time:

#start Self Control block from Terminal
#see https://github.com/SelfControlApp/selfcontrol/wiki/Running-SelfControl-from-the-Terminal    

#calculate block length in minutes
minutes_to_block=`python timetoblock.py`
#timetoblock prints "-1" if the time is between 5 and 10 pm
if [[ $minutes_to_block -le 0 ]]; then echo "done"; exit 0; fi    

#tell Self Control what the block length is (by modifying its defaults)
defaults write org.eyebeam.SelfControl BlockDuration $minutes_to_block    

#start block
sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install

Here's the screen I see when I try to load/start the daemon in Launch Control.

When I hover over "Error 78" on that screen it talks about exit codes, so I figure it has to do with the "exit 0" in my script. However, I'm kind of a bash noob, so I don't know how else I could stop the script. Is there another way, or is the issue with how launchd interprets things?


The problem is that your script is not executable. I've just released a new version of LaunchControl which provides a better problem description and a QuickFix button to solve the issue.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.