7 ms·
> My terminal sat empty for hours. There were no changes – the process was running, but there was no feedback. I was nervous. > What if it failed silently? How
by geofft 5y ago
> My terminal sat empty for hours. There were no changes – the process was running, but there was no feedback. I was nervous.
> What if it failed silently? How can I check? What should I do?
On Linux, find the process ID and run e.g.
ls -l /proc/12345/fd
which will show you all the files currently open by the process. For something like a backup of a whole directory, or something generating a lot of output, run it again a few seconds later. If it's opened different files, then you know it's making progress and it's not stuck.
If it's something that operates on a single file, find the number corresponding to that file in the list (the file descriptor), and run e.g.
cat /proc/12345/fd/3
which will output a "pos" field showing the position in the file, in bytes. Compare it with the actual size of the file, and also run it again a few seconds later to see how fast it's making progress.
(You can also use strace, but that slows down your program and potentially changes how it behaves in extremely unusual cases, so it isn't the first thing I'd reach for unless I really think the program is misbehaving and I want to see what it's doing in more detail. And there are tools like iostat too, but they're systemwide.)
- Dylan16807 5y agoAlso there's the simple method of using iotop or a network equivalent.