Three scripts I need help with.

Hey guys!

First off, I want to say thanks in advance to whoever can give me a hand here.

Alright, so I need three scripts--these are probably way easier than i'm making them out to be, but i can't seem to figure it out.

1-A script that detects if/when a specific user logs in to the system. When the user logs in, it would alert me in some way (say email). The catch is, in order to prevent spam, the alert would only be emailed once per session the user is on.

2-A script that gives the "family tree" of a particular process (pid 1).

3-the last script is to send a "SMS' message to a cell phone. I'm not sure how this would even be done....connect through a website (since most providers let you send text messages free to their customers).

Again, kudos to anyone who can figure this stuff out....you are better than me.

-kallell

I got the SMS part to work, i think the hardest one will be the first script. If anyone has any ideas...or even to point in the right direction it would be appreciated.

make a loop that redirect output from "last USERNAME" to a NEWFILE, compare that file using "diff NEWFILE OLDFILE | mail -s USERNAMEACIVITY kallell", then copy NEWFILE to OLDFILE, if they are the same do nothing.

depending on what ps command you have you could get some milage out of "ps -efx -p 23437"

$ pstree -a 23437

screen
  +-bash
  �   +-su - root
  +-bash
  �   +-centerim-utf8 --no-xtitles --ascii -a
  +-bash
  �   +-mutt
  +-bash
  �   +-emacs etc/style.css
  +-bash
  �   +-man pstree
  �       +-pager -s
  +-bash
      +-pstree -a 23437

alright, i think i got them all working now...just the last just seems ugly as hell (ancestor one).