It is currently Sat, 04 Dec 2021 19:29:03 GMT



 
Author Message
 finger question
Hi:
  I'm write a shell to run on the background that each time someone finger
me, it will send myself an email.

 I use diff to check my .plan file under home directory, if is has changed
then someone is finger me.

 but it turned out finger has no effect to .plan file, only touch will
change .plan.

 my question is : what finger to with .plan file? is there anyway to make
my shell work?

BTW: I'm on sun solaris

  thanks
  tony



 Mon, 21 Jul 2003 09:54:54 GMT   
 finger question
Hi Tony,

can't you replace the finger executable with your script that executes
the finger binairy, but also checks the argument?

pseudocode:

if argument = "Tony"
  email tony
fi
/bin/renamed_bin_that_used_to_be_finger <argument>



 Mon, 21 Jul 2003 22:20:16 GMT   
 finger question
you'd have to have permissions on the finger binary...

the bash shell has a command called stat which displays all the inode
information from the stat structure. Every time a command is read the last
accessed time of the inode is updated in this struct so you could do
something like this:

#!/bin/bash
while [ x ]; do
  MTIME1="$(stat ~/.plan | grep "Access" | awk '{print $5}')"
  sleep 10
  MTIME2="$(stat ~/.plan | grep "Access" | awk '{print $5}')"
  [ "$MTIME1" != "$MTIME2" ] && echo "Fingered" | mail $(id -un)
done
exit 0

This wouldn't work on binary files tho as most flavours of unix don't update
the last access time of executable files when they are run, shell scripts
(and ascii files like .plan) are read however, so the last access time is
changed.

Cheers
S.

news:3A7970A0.B96219D7@nowhere.com...



 Tue, 22 Jul 2003 08:37:17 GMT   
 
   [ 3 post ] 

Similar Threads

1. finger question

2. FINGER question

3. finger question

4. finger question

5. Last fingered question

6. Finger question

7. Finger Question

8. quick finger question

9. finger question


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software