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