> tcsh has the ability to monitor certain users logging on and
> off using:
> set watch(1 username1 any username2 any)
> I have looked all over the place but haven't found anything
> similair under
> bash. Does anyone know the command?
There is a command on my machine called watch
which is kinda like this but it's too interactive,
so to speak. It watches the output of any command
changing. If you type "watch who" it gets in your
way. I have RTFM for a switch that stays completely
quiet until there's a change but no luck
This is overkill but!
#!/bin/bash
(who|cut -d " " -f1|sort|uniq)>new
while (true) do
cp new old
(who|cut -d " " -f1|sort|uniq)>new
diff new old
done
save that as /usr/local/bin/watch and make it executable.
run it in the background ie.
bash# watch &
and whenever someone logs in or out it'll
print it on that terminal while letting you
get on with your work in that terminal
Is there an easy way with the bash to get
a temporary (ie. unique) filename. I don't
want my prog to delete files called "new"
and "old" that may already exist
PS: remove the |sort|uniq if you want to see
all logins (even if that user is already logged
in)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!