zsh-users
 help / color / mirror / code / Atom feed
* can full hostname (instead of IP addr) be reported via 'watch'?
@ 2014-03-12 23:26 rj
  2014-03-13  1:15 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: rj @ 2014-03-12 23:26 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

Man zshparam says, under 'watch,' that '%M' is: 'The full hostname of the
remote host"; and for '%m', says '... If only the IP address is available or
the utmp field contains the name of an X−windows display, the whole name is
printed.

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?





[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: can full hostname (instead of IP addr) be reported via 'watch'?
  2014-03-12 23:26 can full hostname (instead of IP addr) be reported via 'watch'? rj
@ 2014-03-13  1:15 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2014-03-13  1:15 UTC (permalink / raw)
  To: zsh-users

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-13  1:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12 23:26 can full hostname (instead of IP addr) be reported via 'watch'? rj
2014-03-13  1:15 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).