home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / shell / 5095 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.8 KB  |  62 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!gatech!concert!sas!mozart.unx.sas.com!sasmob
  3. From: sasmob@chewy.unx.sas.com (Mark Burhans)
  4. Subject: Re: crontab/script to capture reference to user?
  5. Originator: sasmob@chewy.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <BzDnou.Ao7@unx.sas.com>
  8. Date: Thu, 17 Dec 1992 00:22:06 GMT
  9. Distribution: usa
  10. References:  <1g9tkdINNdc2@agate.berkeley.edu>
  11. Nntp-Posting-Host: chewy.unx.sas.com
  12. Organization: SAS Institute Inc.
  13. Lines: 47
  14.  
  15.  
  16. In article <1g9tkdINNdc2@agate.berkeley.edu>, stevena@triangle.Berkeley.EDU (Steven Alexander) writes:
  17. |> Can references to one's  userid in others' command lines be captured
  18. |> and notice sent to the userid?  I have tried the following, which
  19. |> didn't work:
  20. |> 
  21. |> ============
  22. |> |MY CRONTAB|
  23. |> ============
  24. |> 00,05,10,15,20,25,30,35,40,45,50,55 * * * * sh < [SCRIPT]
  25. |> 
  26. |> ============
  27. |> |  SCRIPT  |
  28. |> ============
  29. |> #!sh
  30. |> ps -au >! [WORKFILE]
  31. |> if grep stevena [WORKFILE] > /dev/null
  32. |> then
  33. |>      mail stevena < [WORKFILE]
  34. |> fi
  35. |> 
  36. |> 
  37. |> Any solutions or hints would be welcome.
  38.  
  39. Heheheheh!  You seem kinda paranoid!  :-)
  40. Ok, I don't know what this line:
  41.        ps -au >! [WORKFILE]
  42. is supposed to be doing, but I'll assume you are looking for processes
  43. on -auxillaries (ie other nodes) and sending that output to a temp file.
  44. Don't know what ">!" does.
  45.  
  46. Anyway, I'd try it this way:
  47.  
  48. -----cut here-----
  49. #!/bin/sh
  50.  
  51. ps -aux | grep stevena | grep -v grep > $WORKFILE
  52. if [ -s $WORKFILE ]; then
  53.   mail stevena < $WORKFILE
  54. fi
  55. -----cut here-----
  56.  
  57. Every 5 minutes?  Every day?  Are you on Clinton's staff?
  58. -- 
  59. ---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
  60. SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
  61. "Polygamy:  One wife too many.  Monogamy:  Same idea."  --Unknown???
  62.