LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-17-2010, 04:26 PM   #1
Fragments
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Korn Shell problem / User Monitoring script


Hello all!

I was fooling around with my home system today and was wondering if anyone has a cshell script that could monitor a user indefinitely. Also is there any way to integrate this type of monitoring with log files using this scripting. This is what I managed to do with korn shell.

Code:
echo Enter user ID 

read user 

echo Enter period of time to be monitored 

read input 

period=$(($input * 3)) 

i=0 

while test $i -lt $period;do 

date>>logs 

ps -e | grep $user>>logs 

sleep 20 

let i=i+1 

done 

cat logs

Last edited by Fragments; 03-17-2010 at 06:28 PM. Reason: Typo
 
Old 03-18-2010, 07:09 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,349

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
Not c-shell, but have a look at this http://www.cyberciti.biz/tips/linux-...ring-tool.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Solaris / OpenSolaris 6 03-18-2009 03:37 AM
Korn shell script mmahulo Linux - Newbie 9 12-17-2008 09:19 AM
script in korn shell disruptive Programming 15 02-22-2007 10:18 AM
unix korn shell script that interact with windows java program ann124 Programming 5 11-09-2004 09:14 PM
Korn shell script Muzica Solaris / OpenSolaris 4 09-06-2004 12:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration