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