Long running binary (written in Go) for Mac OS X that scrapes the UFC website for the next main UFC event and triggers a native OS notification
GOOS=darwin GOARCH=386 go build -o ufc-386 ufc.go # 32 bit MacOSX
GOOS=darwin GOARCH=amd64 go build -o ufc-amd64 ufc.go # 64 bit MacOSX
mv ./ufc /usr/local/bin # update $PATH reference
which ufc # /usr/local/bin/ufc
ufc & # run program in a background process
You can utilise the Mac OS X Launchd service, which controls which programs are launched when the OS boots.
Reference: developer.apple.com/launchd.plist
Modify the ufc-notifier.plist
file inside this repo to include details specific for your needs and move it to the following location:
mv ufc-notifier.plist $HOME/Library/LaunchAgents
Then execute:
cd "$HOME/Library/LaunchAgents"
launchctl load ufc-notifier.plist
Note: this has been tested with Mac OS X version:
10.11.1
To stop this service:
cd "$HOME/Library/LaunchAgents"
launchctl unload ufc-notifier.plist
rm -i ufc-notifier.plist
If you find the service isn't stopping, then it's time to get heavy handed...
- Check the program is indeed handled by Launchd:
launchctl list | grep ufc
- Remove the program:
launchctl remove ufc-notifier
- Verify it's gone:
launchctl list | grep ufc