Skip to content

Basic shell programming question #175

@scripting

Description

@scripting

I have an app that I communicate to via the command line via HTTP to PagePark running on the same machine. I wrote about this a while back. it's working now, and doing what I wanted.

What this is used for, the new version of PagePark can manage processes, using forever-monitor, and I want to implement most of the Forever commands.

Examples: List the running processes, restart a process, stop a process.

One of the commands, "log" will look like this.

pp log 3

This will allow you to watch the tail of the log for process #3 in the bash window you have open at the time. Basically the Node app that's running wants to spawn a command line command like this:

tail -f /tmp/logs/test.txt

And have it take over the console until you press cmd-C.

I do this with:

require ("child_process").exec ("tail -f /tmp/logs/test.txt");

It works. Except the result of the tail command appears invisibly in the console for an invisible bash window. But visibility is the whole point. ;-)

I can catch the stdout stream but only after the command is complete, and in the case of tail, of course, it never completes. In any case, I want to watch it in real time.

So I'm missing a way to launch a command. I want to launch it and have its stdout to appear in the current window. When I'm ready to move on I'll press cmd-c.

Yes all this is to save a bit of typing. That's my philosophy. Grind and factor and simplify and get rid of the labor of using the software where ever possible.

Help much appreciated! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions