Beeminder Forum

My simple TaskRatchet-esque cron job

When the TaskRatchet alpha started, I thought I had a clever idea of how I’d use it. I really wanted to integrate with it via API, to be able to set myself tasks via the command line.

Now, TaskRatchet didn’t officially expose an API per se, but that wasn’t going to stop me. Fine, it doesn’t have a nice clean proper JSON-over-HTTP API, but it does have something which is effectively a plaintext-over-SMTP API! I could write a CLI tool that speaks SMTP, which I could use to set tasks in TaskRatchet for myself!

Well, in retrospect, that was rather overambitious, and by the time I got something half complete, @narthur paused the alpha. Oops. I didn’t even get around to signing up.

But I still wanted to have that CLI tool for setting tasks for myself, so I kept working on what eventually turned into perhaps the simplest possible competitor to TaskRatchet. At its core, it’s a very short bash script whose core is something like this:

while read amount description; do
  curl '' \
    -d auth_token=my_api_token_here \
    -d amount="$amount" \
    -d note="$description"
done < ~myusername/tasks

(This code is released under the MIT license.)
I dropped this script into /etc/cron.daily on my laptop, so that it will run as a daily cron job. (In my case, via anacron.)

In short, what it does is read a file named tasks in my home directory, which is formated along the lines of:

1 Wash the dishes
5 Go to dentist appointment

(i.e. a dollar amount and then a description.)

Each time I complete a task, I remove it from this file. For each task left in the file at the end of the day, the above script charges me the listed amount.

This is very simple and quite barebones. It doesn’t even have a way to configure when tasks are due by! And it requires me to clean up failed tasks manually the next morning. (I could easily fix that by adding a line like truncate -s 0 ~myusername/tasks to the end of the script, but I actually like the notion of having to pay some attention to considering my failed tasks.)

For all that, it works surprisingly well. I haven’t failed at achieving a task I set myself this way so far (in about a week of use), and I’ve accomplished things which I know I definitely would have procrastinated on otherwise.

I’m looking forward to using TaskRatchet when it’s ready, which from my point of view is when it can clearly beat this script in features and ease of use. (Which shouldn’t be hard: there are a lot of features this lacks. But it definitely needs to have an easy way of setting myself tasks via CLI.)

1 Like

Love it! :smiley: This is super relevant to where I’m at with TaskRatchet, as it gives me more data as to what people really need in the service. And scripting is definitely something TaskRatchet will be supporting!

What pain points does this method still leave unsolved?

1 Like
  1. I’d like to be able to set specific times for tasks: e.g. a task might be due at 3pm, instead of it always being due by end of day.

  2. I’d like to be able to enter tasks (and mark them complete) not just from my computer, but also from my (Android) phone. I’d still likely be mostly interacting with it via the command line on my computer, but some fraction of the time doing it via phone is easier.

  3. If I fail at multiple tasks, bundling them into one charge for the total amount instead of one charge for each task. (Maybe Beeminder’s charge endpoint already does this, I don’t actually know.)

  4. Some sort of lock-in for the tasks. I’m uncertain of what exactly would work best, but perhaps something like half an hour after the task is created, it stops you from lowering the dollar amount or making the due time later. I’d still want it to allow me to edit the text of the task, because it is important to me to be able to refine my thoughts about what exactly the task is, and I don’t find that capability something which includes much of a temptation to use it to cheat. (And remember, as with Beeminder, anyone who is determined to cheat can always mark things off as completed when they haven’t been.)


Another very important one I forgot to mention:

  1. Reminders! One of the awesome things Beeminder does is its zeno-polling reminders. I really feel the pain from lack of remainders here. That’s probably my largest pain point that this method doesn’t resolve.