How should I architect a personal schedule manager that runs 24/7?

Posted by Crawford Comeaux on Programmers See other posts from Programmers or by Crawford Comeaux
Published on 2013-06-27T07:26:39Z Indexed on 2013/06/27 10:29 UTC
Read the original article Hit count: 261

I've developed an ADHD management system for myself that's attempting to change multiple habits at once. I know this is counter to conventional wisdom, but I've tried the conventional for years & am now trying it my way. (just wanted to say that to try and prevent it from distracting people from the actual question)

Anyway, I'd like to write something to run on a remote server that monitors me, helps me build/avoid certain habits, etc.

What this amounts to is a system that:

runs 24/7 may have multiple independent tasks to run at once may have tasks that require other tasks to run first lets tasks be scheduled by specific time, recurrence (ie. "run every 5 mins"), or interval (ie. "run from 2pm to 3pm")

My first naive attempt at this was just a single PHP script scheduled to run every minute by cron (language was chosen in order to use a certain library, but no longer necessary). The logic behind when to run this or that portion of code got hairy pretty quick.

So my question is how should I approach this from here? I'm not tied to any one language, though I'm partial to python/javascript.

Thoughts:

  • Could be done as a set of scripts that include a scheduling mechanism with one script per bit of logic...but the idea just feels wrong to me.

  • Building it as a daemon could be helpful, but still unsure what to do about dozens of if-else statements for detecting the current time

© Programmers or respective owner

Related posts about design-patterns

Related posts about JavaScript