home *** CD-ROM | disk | FTP | other *** search
- All I did was to put in a function that keeps track of the PID for
- plan by writing it to a file called ".planpid" in your home directory.
- Now you run plan in your .login, and, to kill the process when you log
- out, put something like this in your .logout:
-
- kill `cat /home/mine/.planpid`
- rm -f /home/mine/.planpid
-
- You have to remove the .planpid (or modify the code), because the
- program will not run if a plan is already running, which it assumes
- when it finds a .planpid file already there.
-
- If someone wanted to run multiple plans, maybe one for a .signature
- and another for a .plan, the save name for the PID could be changed,
- and the program compiled twice (the binary is not that big, ~40K on
- the HP 425's I used), or, if someone is really motivated, they could
- add a command line argument for the save name.
-
- Sure, my modification isn't very complex, but it does what I needed
- it to do, and maybe someone else can use it.
-
- Karen (napalm@ugcs.caltech.edu)
-
- **** Additions by Geoff Loker ****
-
- I have modified Tony Rems' code for plan a bit to get rid of the
- necessity for hard-coding in the file name to be set up as a FIFO.
- The program will now accept an optional argument that specifies the
- name of the FIFO to be used. If that argument is not set, the default
- FIFO is $HOME/.plan.
-
- In order to use this program, your O/S needs to support named pipes.
- You also need to link in getopt for the changes to work.
-
- Any executable program can be set up to run when the specified FIFO is
- opened, but don't forget that the program you specify to run is being
- run under your userid.
-
- **** Original README ****
-
- Date: Thu, 11 Apr 91 14:09:10 MST
- From: Jim Armstrong <armstron@cs.arizona.edu>
- Subject: RE: fingeree ...
-
- > >About a month ago there was a sample program posted to this newsgroup that
- > >set up a FIFO named pipe as your .plan file. I modified the code to set up
- > >a simple (perhaps naive) finger monitor for users on my machine. The process
- > do you still have the source for it? would you send it to me?
-
- Here is the article which appeared in comp.unix.questions a while back. It
- contains generic code that will run any program you want whenever a certain
- file is accessed (i.e. the .plan file in this case). All you have to do is
- compile it (it creates an executable called 'plan') and then to get it
- running say 'plan a.out &' where a.out is some program you have written.
- I don't have my program any more, but basically what I did was a ps au
- within that program. It used egrep to search for someone currently fingering
- me and appended the output to a file. To get really fancy you could then
- read from that file to find out exactly who it is (all in the same program)
- and print out a nice personal message to whoever is fingering you as part
- of what looks to be your .plan file. A couple of things to watch out for:
- If the finger is remote, the ps au won't find anything. Also, if two people
- finger you at the same time you may run into trouble, but I didn't try
- experimenting with this too much. I also found it helpful to timestamp a
- date to the file, too (I used localtime() for efficiency). This makes it
- easier to look back later at the file and see who's been fingering you and
- when while you were not logged on. It also helpful in debugging your program.
-
- So set up this code and experiment with different programs. Just be creative
- and see what else you can do with it. One idea I used for a while is making
- it print a different quote each time. The possibilites are endless. Enjoy.
-
- Jim
-
-
- Article 31270 of comp.unix.questions:
- From: rembo@unisoft.UUCP (Tony Rems)
- Newsgroups: comp.unix.questions
- Subject: Re: Finger
- Date: 22 Feb 91 02:44:17 GMT
- Reply-To: rembo@unisoft.UUCP (Tony Rems)
- Organization: UniSoft Corporation -- UNIX R Us.
-
- In article <37675@netnews.upenn.edu> minzhi@eniac.seas.upenn.edu (Min-Zhi Shao) writes:
- >
- > When I fingered our system administrator, I got the following result:
- >
- >_________________________________________________________________________
- >Login name: gardella In real life: Ed Gardella [CETS]
- >Directory: /home/cets/gardella Shell: /usr/local/bin/bash
- >On since Feb 15 19:49:04 on ttyp1 from TSTEST.SEAS.UPEN
- >14 minutes Idle Time
- >No unread mail
- >Project: System Administrator eniac.seas.upenn.edu
- >Plan:
- > Meander about until something interesting comes along.
- >
- >Office: 154 Moore Building Work Phone: 898-2491
- > Home Phone: 387-4104
- >
- >I have been fingered 3 times today
- >_________________________________________________________________________
- >
- >the .plan file in his home directory looks like:
- >
- >prw-r--r-- 1 gardella 0 Feb 15 23:48 /home/cets/gardella/.plan
- >^
-
- As you have found out by now, I'm sure, the p means that this is
- a named pipe aka a FIFO. If you'd like to do this yourself, here
- is a little program I wrote to do it (see the comments at the
- the beginning of the plan.c file for usage info):
-
- Here's the shar of my plan program, just cut up until it says
- "cut here", and then type 'sh filename' using whatever filename
- you save it as. If you use 'plan' it will get overwritten.
-
- The code here should compile w/o any problems on any BSD machine,
- I have tried it on a Sun, Vax 750, and Pyramid 90x. It should
- also work properly on any SVR4.0 machine.
-
- The code is pretty heavily commented so it should be self
- explanatory.
-
- Note that you should put a -DFILENAME="your_home_dir/.plan"
- to get it to put your path in, or you can just edit the
- source and change the value of FILENAME permanently.
-
- If you have any problems getting it compiled, just send me mail.
-
- Enjoy.
-
- -Tony
-
-