神刀安全网

A minimal eventloop implementation in bash

pushloop

Basically a super-cheap poor-man’s-eventloop

Usecase

Cheap imitation plastic daemon for an evented run-action without actually being any of those things

Using

You want tmux or screen for this. Right now screen’s hardcoded in the bootstrap, but no reason that can’t change. I just don’t want to try figure it out now.

It listens on a FIFO, waits for a match condition (grep) and then runs the script you specify. And where that says "listens", it really only means while read line .

Settings

Export these

  • MATCH = the match text
  • ACTION = the script you want to run
  • TIMEOUT = haha, funny
  • INPATH = the fifo to read

Assumptions

  • That you have bash
  • That you use with this with the understanding it’s a cheap imitation plastic daemon
  • Settings are at ${HOME}/.pushloop
  • That you have a modicum of shell skills (because this will probably break)

Name

Get out and push

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » A minimal eventloop implementation in bash

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址