Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have some custom command line programs at our Windows shop. These commands are scheduled to run (from within bat files) at regular intervals using the Task Scheduler. Our tasks pull data from other systems and shuffling information in files through bins used to manage our workflow. Sometimes a task runs long -- really long -- and it leaves us wondering if the console app is actually doing work or if it's hung somehow. (These apps communicate over the network with other applications.) Anyhow, I'm wondering if there's a way to tell whether the app is doing something or if it's idle. It's dangerous to our processing to kill such a task midstream, but we do have to kill a process if it's just going to remain hung to allow other work through. (Maybe a file lock might cause this, I dunno.)

I realize we could add logging to our individual apps but I'm hoping to find a solution that can be composed (piped) somehow -- for example, by maybe piping our STDIN/OUT through another monitoring console app. Is this reasonable? Is there something like this on either Unix or Windows?

customcmd | monitor "progress.txt" --label customcmd < customdata.txt > result.txt 2> error.txt

And maybe the progress.txt looks something like this:

5:01:10pm - customcmd - 20 reads, 20 writes
5:01:15pm - customcmd - 11 reads, no writes
share|improve this question
    
If you are piping STDIN/STDOUT anyway, why not just pipe them to a file directly? And then use (for example on Linux) tail -f file1 -f file2 -f file 3 to track all 3 files on the same window. There is also a Unix package (supposedly runs on Cygwin as well) called multitail which divides the window up for each log. Or you can write a program that collects and process your logs. –  Peon Jan 10 '14 at 20:14
    
What is "hung" in your definition? What is running in fact? Cmd/PowerShell/bash/your application? Solutions may vary... –  Maximus Jan 11 '14 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.