PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 4, 2022

[FIXED] How to see the current running Linux processes output^

 July 04, 2022     linux, output, process, terminal, verbose     No comments   

Issue

I have several Linux (Ubuntu 10.04) processes running on my computer. If I start one of them, I can see the verbose of it on my terminal. I have an other process that start a dozen of those processes so that they run in background. However, I would like to watch the output of one of these processes to see if the output is still ok and there are no error message. I know I could send everything into a log message, however, this would just use too much disk space. So, is there a way to "catch" the output of a running process in Linux using it's process Id?


Solution

Use redirection like

yourprogram arg1 arg2 > yourprog.out

or probably even (to redirect both stderr & stdout and run in the background)

yourprogram arg1 arg2 > yourprog.out 2>&1 &

In a different terminal, do

tail -f yourprog.out 

With the -f option, the tail command will notice when the file is growing and will display its newest lines

But I can't see portable way to redirect after. Maybe screen, batch, at, cron might help you. Or opening the /proc/1234/fd/1 ...

BTW, I am surprised you don't have enough temporary disk space for your output...

And I do like running M-x shell under emacs, and running my programm there.



Answered By - Basile Starynkevitch
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing