Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: can full hostname (instead of IP addr) be reported via 'watch'?



On Mar 12,  7:26pm, rj wrote:
}
} Where I'm using 'watch', only the IP address is given in place of '%M'.
} How would it be possible to have it report the actual host name instead of
} the IP address?  Does it depend on what's in the utmp or wtmp files?

Yes, it depends on what is read from the utmp data structure.  It's
pretty much up to the system admin whether the reverse lookup on the
IP address is done when the utmp entry is created; I would imagine
that on some big shell-server hosts like Panix they avoid it to keep
the network overhead down and the login process faster.

There isn't any convenient way to work around this, WATCHFMT doesn't
expand any other substrings the way e.g. prompts can be made to.

You could set up something to periodically run the "log" builtin and
postprocess the output ... or you could run another shell with zpty,
whose only purpose is to emit watch output, and then monitor the pty
with zle -F and postprocess whatever it spits out.  But those are
pretty much your only options.



Messages sorted by: Reverse Date, Date, Thread, Author