Sponsored Content
Top Forums Shell Programming and Scripting Write a scripts to kill idle user for 60 min. & email user list to admin in text file Post 302507784 by guto on Thursday 24th of March 2011 07:27:02 PM
Old 03-24-2011
To address the 5th point of your steps, just use the mail utility if you have it installed on your system. Check its man page for detail.
As far as the 8th point, I would approach it in the following manner;

Outside the loop do this:
Code:
if [ "`eval echo $idletimes`" != "" ]; then
  eval TUSRS=`wc -l $idletimes |awk '{ print $1 }'`
  USRS=""
fi

Inside the loop to the following:
Code:
if [ "`evel echo $USRS`" = "" ]; then
  eval USRS=`ehco $idletimes |sed 15q`
else
  if [ `eval echo $TUSRS` -gt `eval echo $USRS` ]; then
     PLINE=`eval expr '$TUSRS' - '$USRS'`
     NUSRS=`sed '$USRS,$PLINE!d'`
  fi
fi

The last block of code needs to be within a loop for it to work appropriately. This should work fine, but if you have problems let me know. I have not tested it because I have no access to an AIX server.
By the way, the points that you have already taken care of can be improved to be more efficient...
This User Gave Thanks to guto For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

user & group read/write access question

folks; I created a new users on my SUSE box and i need to give this user/group a read write access to one specific folder. here's the details: - I created new user "funny" under group "users". - I need to give this user "funny" a read/write access to another directory that is owned by "root".... (3 Replies)
Discussion started by: Katkota
3 Replies

2. UNIX for Dummies Questions & Answers

Difference between : Locked User Account & Disabled User Accounts in Linux ?

Thanks AVKlinux (3 Replies)
Discussion started by: avklinux
3 Replies

3. UNIX for Advanced & Expert Users

Send email as a different user than the user logged in

Hi I am using mailx to send email and am wondering if there is a way I can send the email from a different user than the user logged in. something like do-not-reply@xyz.com Thank you. (1 Reply)
Discussion started by: rakeshou
1 Replies

4. Shell Programming and Scripting

How to kill process after x idle min?

I need a script to kill those process id whose idle time is more than 30min plz help me (3 Replies)
Discussion started by: salil2012
3 Replies

5. Homework & Coursework Questions

[Scripting]Find & replace using user input then replacing text after

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: (o) Checkout an auto part: should prompt the user for the name of the auto part and borrower's name: Name:... (2 Replies)
Discussion started by: SlapnutsGT
2 Replies

6. Shell Programming and Scripting

User idle time and kill

Hello.. I have many sleepy users on my Solaris box and need to kill them if they are idle for more than 45 minutes for example...I know who -u gives and the idle time but unable to make a awk line to get the condition perfect. Please help...:wall: (9 Replies)
Discussion started by: wimaxpole
9 Replies

7. Shell Programming and Scripting

Script to Send Email to a user when an admin kills process

Can anyone create or give me a script that I can use to email a user automatically when I kill one of their processes? Or Can you give me a script to allow me to email a user (entering email manually) when a process is killed? Like showing what the PID was and a reason the admin killed it? Is... (2 Replies)
Discussion started by: JoeGazz84
2 Replies

8. Shell Programming and Scripting

set only some command & scripts permission to a particular user

hi, i am new in unix.......i am using bash and i want to create a user which has only some command and scripts permission.........is it possible? thanx (1 Reply)
Discussion started by: rakeshtomar82
1 Replies

9. Homework & Coursework Questions

Need to write a script user.sh that parses name & password

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a script called user.sh that parses the name and password of given in a file (user.txt) and creates the user... (1 Reply)
Discussion started by: Nygenesis
1 Replies

10. UNIX for Dummies Questions & Answers

Deletion of list of user based on a text file In LDAP UNIX server

Dear All, It would be really nice, if you could help me to write a script for deletion of list of user( more than 15000 users) stored in a file and sorted by email address( i need deletion of only a particular type of mail address). Is the any script to write and take the file as input and... (3 Replies)
Discussion started by: Chand
3 Replies
update(n)						       Tcl Built-In Commands							 update(n)

__________________________________________________________________________________________________________________________________________________

NAME
update - Process pending events and idle callbacks SYNOPSIS
update ?idletasks? _________________________________________________________________ DESCRIPTION
This command is used to bring the application "up to date" by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed. If the idletasks keyword is specified as an argument to the command, then no new events or errors are processed; only idle callbacks are invoked. This causes operations that are normally deferred, such as display updates and window layout calculations, to be performed imme- diately. The update idletasks command is useful in scripts where changes have been made to the application's state and you want those changes to appear on the display immediately, rather than waiting for the script to complete. Most display updates are performed as idle callbacks, so update idletasks will cause them to run. However, there are some kinds of updates that only happen in response to events, such as those triggered by window size changes; these updates will not occur in update idletasks. The update command with no options is useful in scripts where you are performing a long-running computation but you still want the applica- tion to respond to events such as user interactions; if you occasionally call update then user input will be processed during the next call to update. EXAMPLE
Run computations for about a second and then finish: set x 1000 set done 0 after 1000 set done 1 while {!$done} { # A very silly example! set x [expr {log($x) ** 2.8}] # Test to see if our time-limit has been hit. This would # also give a chance for serving network sockets and, if # the Tk package is loaded, updating a user interface. update } SEE ALSO
after(n), interp(n) KEYWORDS
event, flush, handler, idle, update Tcl 7.5 update(n)
All times are GMT -4. The time now is 09:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy