zeke / remind-me

A command-line reminder tool that supports natural language dates and times, inspired by Slack's remind feature (UNMAINTAINED)
http://npm.im/remind-me
81 stars 11 forks source link

This thing almost works, but I need your help #2

Closed zeke closed 8 years ago

zeke commented 8 years ago

Greetings, stargazers!

I don't know how you found this repo but I'm glad you did. I've been working on it in fits and spurts as time permits, and it's nearly ready for primetime. But I need your help in the final push to making it useful.

To give it a try:

  1. Make sure you're using iojs or node >= 4
  2. npm i -g remind-me
  3. remind me to buy groceries tomorrow at noon
  4. remind config
  5. remind edit

For the most part, the thing works. But there's one catch. There's not yet a background process that checks for upcoming reminders and sends out notifications. :(

I can manually run remind sweep and everything works. "Imminent" notifications go out via say, desktop notifications, and Twilio SMS.

I want the npm install process to set up a daemon/agent/what-have-you that will periodically run remind sweep (or keep it running all the time with setInterval set to some reasonable interval like 30 seconds). I have a crontab thing set up in lib/setup.js. When I run crontab -l in my terminal I can see the entry, but it doesn't seem to be running. Or if it is running, it's failing and outputting to the ether. Does the crontab process run in some kind of subshell or something that doesn't have my globally installed node modules on its PATH?

I was also thinking of trying some launchctl abstration, but plist files are scary, plus that would limit the module to Mac users only.

Let me know if you have ideas, and please send pull requests if you're so inclined.

:raised_hands:

Zeke

curl https://api.github.com/repos/zeke/remind-me/stargazers | json -a login

@kennethormandy @Flet @azer @matthewmueller @kgryte @jonschlinkert @yoshuawuyts @javierarce @sugarshin @Whoaa512 @justinsisley @kohlerm @kostasx @sjmarshy @christianboyle @svlasov @therebelrobot @jaridmargolin @slattery

zeke commented 8 years ago

Ok stargazers, no responses so I had to pull a little red :chicken: to get this working. The problem was that node was not on the $PATH. Here's how I fixed it:

// cron doesn't have `node` on its $PATH, so prepend it
let nodeDir = path.dirname(exec('which node'))
let pathString = `export PATH=${nodeDir}:$PATH;`
let cronLogs = `>~/.remind-me/cron.stdout.log 2>~/.remind-me/cron.stderr.log`
let cronString = `${pathString} remind sweep ${cronLogs}`

It's ready for use! Please have a go and give feedack:

npm rm -g remind-me && npm i -g remind-me && remind
azer commented 8 years ago

nice work! cheers

Flet commented 8 years ago

I just saw eslint_d pop up on echojs and I thought of this tool.

It looks like eslint_d will start a daemon when the command is run and keep it running for subsequent commands, This is done to speed up the linting time, but could this also be done in remind-me to start the daemon for notifications?

This could also help avoid cron and other native schedulers... just make sure remind-me runs at startup.

zeke commented 8 years ago

eslint_d looks pretty nice. @mantoni is making very good use of node builtins there.

The trouble I was having was with automating this:

just make sure remind-me runs at startup.

eslint_d doesn't appear to run the server at system startup, but rather at first invocation.

mantoni commented 8 years ago

There is an explicit start command for eslint_d. One could put that into any startup script. Running the server on first invocation is a convenience feature to not have to start it manually if it's not running.