Stand up every 20 minutes (mac os)

Foreword : Inspired by excellent post

Initial task: creating notification every 20 minutes can be decomposed into two parts:

  1. create notification
  2. scheduled launch

First subtask can be solved using this trivial script.


# stand up notification

osascript -e 'display notification "Stand up" with title "Healthy programmer"'

say "Stand up"

Second subtask (scheduled launch) can be solved using: daemon and agent mechanism.

Create file: com.example.stand.up.plist and place it into ~/Library/LaunchAgents/.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">





To start using this file (add to scheduler):

launchctl load ~/Library/LaunchAgents/com.example.start.up.plist

To stop using this file (remove from scheduler):

launchctl unload ~/Library/LaunchAgents/com.example.start.up.plist

To list scheduled tasks

launchctl list

After reboot this file com.example.start.up.plist will be used automatically.