Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Killing all active shells without rebooting Post 302202525 by bakunin on Thursday 5th of June 2008 04:29:58 AM
Old 06-05-2008
First the good news: if you are root yourself (that is: have the necessary privileges) you can close all the other users shell (including roots sessions) exactly the way you want.

I am no Linux specialist and the output (and the options) of the used commands differ somewhat from UNIX derivate to UNIX derivate so i can tell you only generally how that is done:

Have a look at the "who" command (enter "man who") which will provide you with all the process IDs (PIDs) of the other shell sessions. Use some sort of text filter ("sed" or "awk" usually) to trim that down to a bare list of process IDs and use "kill" on each of these processes to end it. That will effectively log off the user.

Here is a schema of such a script:

Code:
who <some options> | sed <some trimming commands> | while read PID ; do
     kill -9 $PID
done

I hope this helps.

bakunin

PS: may i ask which purpose the poll serves?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

soft rebooting

When I do a hard reboot, the system recognizes both the ttya and the ttyb, but when I do a hard reboot, it only doesn't recognize the ttyb. Is there a way I can fix this??? Thanks!:confused: (5 Replies)
Discussion started by: nattie_h
5 Replies

2. Shell Programming and Scripting

Killing parent shells from subshells (KSH)

Hi all, I have a shell script which calls other shell scripts, depending on the input. Within a.sh, I have a command which calls b.sh (ie. ksh b.sh) Normally, we use the exit function to terminate a shell. However, if I choose to call exit from b.sh, I will return to the parent shell who... (4 Replies)
Discussion started by: rockysfr
4 Replies

3. UNIX for Advanced & Expert Users

Active / Non Active users ?

Hey, I have few Questions : 1. How to Check/Find who all are the users accessing the server using their id ? 2. How to Check who is the active user or non active user (whose id exists but the access privileges has been removed) ? I am presently using AIX5.3 as a server. Please suggest... (3 Replies)
Discussion started by: varungupta
3 Replies

4. AIX

hmc not rebooting

Anyone faced this? I rebooted the HMC through command line after patch installation (hmcshutdown -t now -r) The strange thing happened was the hmc never rebooted, I was not able to connect it through graphical view or through ssh, but the session through which i issued the command was still... (4 Replies)
Discussion started by: balaji_prk
4 Replies

5. AIX

Question about HACMP for active-active mode

Hi all, I am new to HACMP. So sorry for the newie question. But I did search the forum and it seems that no one asks this before. So if a 2-node cluster runs in active-active mode (and the same application), what is the benefit of using HACMP ? If it runs in active-stanby, it is easy to... (9 Replies)
Discussion started by: qiulang
9 Replies

6. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

7. Solaris

Link based Active Active IPMP

Hi, I need to configure 4 ip address (same subnet and mask) in one ipmp group (two interfaces) in an active active formation (link based). Can some one provide the steps or a tutorial link. Thanks (2 Replies)
Discussion started by: Mack1982
2 Replies

8. AIX

rebooting HMC

Hi, I would like to know wheather rebooting HMC will impact on Management Systems or Lpar inside it is showing? or I have to shutdown LPAR then only reboot HMC. (7 Replies)
Discussion started by: manoj.solaris
7 Replies

9. Shell Programming and Scripting

How do I calculate total number of active and non active hosts?

#!/bin/bash for digit in $(seq 1 10) do if ping -c1 -w2 192.168.1.$digit &> /dev/null then echo "192.168.1.$digit is UP" else echo "192.168.1.$digit is DOWN" fi done (3 Replies)
Discussion started by: fusetrips
3 Replies

10. What is on Your Mind?

Rebooting a career

Apologies if this is not the correct place to post this. I used to have a job supporting several custom applications that ran on Unix platforms. I used shell scripting, sed, awk, and SQL, but all on a pretty basic level. I also performed non-technical tasks like helping with project management,... (4 Replies)
Discussion started by: intranslation
4 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 05:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy