tail utility doesn't work as expected
Hello,
I start monitoring is process alive using tail utility by tail -Fn0 --pid=11111 /opt/mylogfile.log Process with PID 11111 was restarted and now this process has other PID 22222 but I still see that tail continue monitoring for process with PID 11111. Could it be a tail issue? Icheck /proc and failed to find /proc/11111. May be tail just hangs? |
that is the expected behavior. tail has no any idea about your activity (=you restarted the process). tail will keep doing what was told (monitoring the given pid) until you stop it.
|
Restarting process is to send TERM to it and start it again. When process exit tail should exit also because PID 11111 doesn't exist anymore
|
no, that is not true. tail -F means: keep trying (see man page). Additionally tail has no way to know the new pid.
|
-F is about file specified, not pid
pid is monitored by --pid |
pid is specified by --pid. -F means --follow and --retry. --retry means: keep trying to open a file if it is inaccessible
It is the tail process itself, not the flag which will monitor the given pid and will try it forever (as long as it was not interrupted). |
--pid means: with -f, terminate after process ID, PID dies
It just exists, nothing more |
In that case you are right, tail utility doesn't work as you expected.
|
Quote:
|
All times are GMT -5. The time now is 12:22 PM. |