home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / planner / part01 / readme.orig < prev    next >
Encoding:
Text File  |  1993-08-23  |  5.5 KB  |  134 lines

  1. All I did was to put in a function that keeps track of the PID for
  2. plan by writing it to a file called ".planpid" in your home directory.
  3. Now you run plan in your .login, and, to kill the process when you log
  4. out, put something like this in your .logout:
  5.  
  6.     kill `cat /home/mine/.planpid`
  7.     rm -f /home/mine/.planpid
  8.  
  9. You have to remove the .planpid (or modify the code), because the 
  10. program will not run if a plan is already running, which it assumes
  11. when it finds a .planpid file already there.
  12.  
  13. If someone wanted to run multiple plans, maybe one for a .signature
  14. and another for a .plan, the save name for the PID could be changed,
  15. and the program compiled twice (the binary is not that big, ~40K on
  16. the HP 425's I used), or, if someone is really motivated, they could
  17. add a command line argument for the save name.
  18.  
  19. Sure, my modification isn't very complex, but it does what I needed
  20. it to do, and maybe someone else can use it.
  21.  
  22. Karen    (napalm@ugcs.caltech.edu)
  23.  
  24. ****  Additions by Geoff Loker ****
  25.  
  26. I have modified Tony Rems' code for plan a bit to get rid of the
  27. necessity for hard-coding in the file name to be set up as a FIFO.
  28. The program will now accept an optional argument that specifies the
  29. name of the FIFO to be used.  If that argument is not set, the default
  30. FIFO is $HOME/.plan.
  31.  
  32. In order to use this program, your O/S needs to support named pipes.
  33. You also need to link in getopt for the changes to work.
  34.  
  35. Any executable program can be set up to run when the specified FIFO is
  36. opened, but don't forget that the program you specify to run is being
  37. run under your userid.
  38.  
  39. ****  Original README ****
  40.  
  41. Date: Thu, 11 Apr 91 14:09:10 MST
  42. From: Jim Armstrong <armstron@cs.arizona.edu>
  43. Subject: RE: fingeree ...
  44.  
  45. > >About a month ago there was a sample program posted to this newsgroup that
  46. > >set up a FIFO named pipe as your .plan file.  I modified the code to set up
  47. > >a simple (perhaps naive) finger monitor for users on my machine.  The process
  48. > do you still have the source for it? would you send it to me?
  49.  
  50. Here is the article which appeared in comp.unix.questions a while back.  It
  51. contains generic code that will run any program you want whenever a certain
  52. file is accessed (i.e. the .plan file in this case).  All you have to do is
  53. compile it (it creates an executable called 'plan') and then to get it
  54. running say 'plan a.out &' where a.out is some program you have written.
  55. I don't have my program any more, but basically what I did was a ps au
  56. within that program.  It used egrep to search for someone currently fingering
  57. me and appended the output to a file.  To get really fancy you could then
  58. read from that file to find out exactly who it is (all in the same program)
  59. and print out a nice personal message to whoever is fingering you as part
  60. of what looks to be your .plan file.  A couple of things to watch out for:
  61. If the finger is remote, the ps au won't find anything.  Also, if two people
  62. finger you at the same time you may run into trouble, but I didn't try
  63. experimenting with this too much.  I also found it helpful to timestamp a
  64. date to the file, too (I used localtime() for efficiency).  This makes it
  65. easier to look back later at the file and see who's been fingering you and
  66. when while you were not logged on.  It also helpful in debugging your program.
  67.  
  68. So set up this code and experiment with different programs.  Just be creative
  69. and see what else you can do with it.  One idea I used for a while is making
  70. it print a different quote each time.  The possibilites are endless.  Enjoy.
  71.  
  72. Jim
  73.  
  74.  
  75. Article 31270 of comp.unix.questions:
  76. From: rembo@unisoft.UUCP (Tony Rems)
  77. Newsgroups: comp.unix.questions
  78. Subject: Re: Finger
  79. Date: 22 Feb 91 02:44:17 GMT
  80. Reply-To: rembo@unisoft.UUCP (Tony Rems)
  81. Organization: UniSoft Corporation -- UNIX R Us.
  82.  
  83. In article <37675@netnews.upenn.edu> minzhi@eniac.seas.upenn.edu (Min-Zhi Shao) writes:
  84. >
  85. >    When I fingered our system administrator, I got the following result:
  86. >
  87. >_________________________________________________________________________
  88. >Login name: gardella              In real life: Ed Gardella [CETS]
  89. >Directory: /home/cets/gardella          Shell: /usr/local/bin/bash
  90. >On since Feb 15 19:49:04 on ttyp1 from TSTEST.SEAS.UPEN
  91. >14 minutes Idle Time
  92. >No unread mail
  93. >Project: System Administrator eniac.seas.upenn.edu
  94. >Plan:
  95. >         Meander about until something interesting comes along.
  96. >
  97. >Office: 154 Moore Building           Work Phone: 898-2491
  98. >                                     Home Phone: 387-4104
  99. >
  100. >I have been fingered 3 times today
  101. >_________________________________________________________________________
  102. >
  103. >the .plan file in his home directory looks like:
  104. >
  105. >prw-r--r--  1 gardella        0 Feb 15 23:48 /home/cets/gardella/.plan
  106. >^
  107.  
  108. As you have found out by now, I'm sure, the p means that this is 
  109. a named pipe aka a FIFO.  If you'd like to do this yourself, here
  110. is a little program I wrote to do it (see the comments at the
  111. the beginning of the plan.c file for usage info):  
  112.  
  113. Here's the shar of my plan program, just cut up until it says
  114. "cut here", and then type 'sh filename' using whatever filename
  115. you save it as.  If you use 'plan' it will get overwritten.
  116.  
  117. The code here should compile w/o any problems on any BSD machine,
  118. I have tried it on a Sun, Vax 750, and Pyramid 90x.  It should
  119. also work properly on any SVR4.0 machine.  
  120.  
  121. The code is pretty heavily commented so it should be self
  122. explanatory.  
  123.  
  124. Note that you should put a -DFILENAME="your_home_dir/.plan"
  125. to get it to put your path in, or you can just edit the 
  126. source and change the value of FILENAME permanently.  
  127.  
  128. If you have any problems getting it compiled, just send me mail.
  129.  
  130. Enjoy.  
  131.  
  132. -Tony
  133.  
  134.