0

I have an active log file (which means there are new lines of log information appended to the file in real time).

What I want: When there is a new line appended, pass the new line of log as a parameter to a script (Bash, C, or even PHP).

What is better: instead of open a new process for every new line of log appended, run a demon process in the background to accept each line of new input.

I tried to Google, but haven't found any useful keyword to start.

By the way, it's running on Debian.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Shiji.J
  • 1,561
  • 2
  • 17
  • 31
  • It sounds like you want a variant of `tail -f` that executes a script with each line as it is appended to the log file. I think you'll have to write that, probably. It shouldn't be too hard to do, but most people have not found it necessary. – Jonathan Leffler Dec 30 '15 at 02:58

1 Answers1

0

instead of open a new process for every new line of log appended, run a demon process in the background to accept each line of new input.

tail -f log | demon&
Armali
  • 18,255
  • 14
  • 57
  • 171