The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 10:45 AM
FTP Scripts raghav1982 Shell Programming and Scripting 27 12-07-2007 03:38 AM
use of ssh in scripts esham Shell Programming and Scripting 7 11-16-2005 08:27 AM
Help with GDL to SQL scripts ch4r1e5 Shell Programming and Scripting 0 10-31-2005 02:51 PM
using su in scripts uchachra UNIX for Dummies Questions & Answers 3 03-11-2002 10:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-09-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
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
Reply With Quote
Forum Sponsor
  #2  
Old 02-09-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
a

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.
Reply With Quote
  #3  
Old 02-09-2008
HPAVC's Avatar
Registered User
 

Join Date: Feb 2008
Posts: 105
Quote:
Originally Posted by kallell View Post
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.
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.

Quote:
Originally Posted by kallell View Post
2-A script that gives the "family tree" of a particular process (pid 1).
depending on what ps command you have you could get some milage out of "ps -efx -p 23437"

Code:
$ 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
Reply With Quote
  #4  
Old 02-09-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
alright, i think i got them all working now...just the last just seems ugly as hell (ancestor one).
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0