I currently have a background process on my unix server that's running hours longer than it should be.
I can't remember the command to allow me to see the output of a background process. I'll remember to bookmark this answer!
I currently have a background process on my unix server that's running hours longer than it should be.
I can't remember the command to allow me to see the output of a background process. I'll remember to bookmark this answer!
What also might be useful if you're uncertain whether it's doing anything at all, is use 'strace'.
If your app is the 'dhcpd' service, run ps ax | grep [d]hcpd
$ ps axufw | grep [d]hcpd
dhcpd 21645 0.0 0.1 19156 4956 ? Ss Oct02 0:00 /usr/sbin/dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/ltsp/dhcpd.conf
Your PID is 21645, so you'd run sudo strace -p 21645
. Or drop the 'sudo' if you're root already.
It will get the system calls from your application in real time and tell you precisely what your program is doing.
Note: Wrap a letter of the grep command in a bracket to strain out the grep command itself.
As a follow up to Mariano Montañez Ureta.
If you can see the task in the jobs
window, all you should be able to see something like this:
$ jobs
[1]+ Running tail -f .ssh/known_hosts &
If you then use the fg
command coupled with the job number you can bring that to the foreground, i.e. fg %1
would bring my tail
command to the foreground. You can also use the fg
command with a PID.
tail -f whatever-file-the-process-is-writing-to.txt