Skip to main content

A cron job to remember my fantasy NBA roster

October 22, 2026•4 min read

I play fantasy NBA. The worst way to lose a week is to forget the roster. An injured player stays in the lineup, and the points are gone.

I do not need an app for this. I need a small push at the same time every morning. macOS already has everything for it: cron and osascript.

The job

This is the full reminder:

crontab
30 8 * * * /usr/bin/osascript -e 'display notification "Check your fantasy NBA roster" with title "Fantasy reminder"'

Every morning at 08:30, a notification shows up with the title "Fantasy reminder". That's it.

The first five fields are the schedule. The rest is the command.

cron fields
┌───────── minute (0-59)
│  ┌────── hour (0-23)
│  │ ┌──── day of the month (1-31)
│  │ │ ┌── month (1-12)
│  │ │ │ ┌ day of the week (0-6, 0 is Sunday)
│  │ │ │ │
30 8 * * *  command

A * means "every". So 30 8 * * * means 08:30, every day, every month, every day of the week.

Some other examples:

  • 30 8 * * 1-5: 08:30 from Monday to Friday.
  • 0 */2 * * *: every 2 hours, on the hour.
  • */5 * * * *: every 5 minutes. Good for a test, bad to forget.

The command uses the full path /usr/bin/osascript. Cron runs with a very small PATH, so a full path is the safe choice.

You can try the notification before you schedule it:

terminal
osascript -e 'display notification "Check your fantasy NBA roster" with title "Fantasy reminder"'

If nothing shows up, open System Settings → Notifications and allow the notifications for Script Editor. macOS shows the osascript notifications under that app.

Operate the list of cron jobs

Each user has one crontab. The crontab command is the only interface you need.

terminal
crontab -l   # list your jobs
crontab -e   # edit your jobs in $EDITOR

crontab -e opens a temporary file. When you save and close the editor, cron installs the new list. If the editor is vim, that is :wq.

To remove one job, run crontab -e and delete the line.

Be careful with crontab -r. It removes all your jobs, with no question first. The e and the r are neighbors on the keyboard. Keep a backup:

terminal
crontab -l > ~/crontab.backup   # save the list
crontab ~/crontab.backup        # restore the list

One more thing about macOS: cron does not run a job that it missed. If the laptop sleeps at 08:30, no reminder that day. For a fantasy roster, I can live with that.

Then I got mail

A few days later, every new terminal tab started with this line:

terminal
You have mail.

I did not know that my Mac had a mailbox. It does. When a cron job writes something to stdout or stderr, cron sends that output as an email to the local user. The emails stay in /var/mail/$USER.

One of my jobs failed on every run. Each failure was one more email.

Read and clean the mailbox

macOS includes the old mail command. Run it without arguments to open the mailbox:

terminal
mail

It shows a numbered list of messages. These are the commands I needed:

Command What it does
1 Read message 1.
h Show the list of messages again.
d 1 Delete message 1.
d 1-20 Delete messages 1 to 20.
d * Delete all messages.
q Quit and save the changes.
x Quit and discard the changes.

So the cleanup was mail, then d *, then q.

The fantasy reminder prints nothing, so it never sends mail. It only reminds me to check the roster. Now I need a cron job to remind me to make better trades.