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:
#!/bin/sh #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
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?