Script for to kill the process Ids when restarting the unix server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for to kill the process Ids when restarting the unix server
# 1  
Old 02-24-2012
Script for to kill the process Ids when restarting the unix server

Hi,

I need a script to kill the process Ids for the user ABC.
I prepared the following script after that while logging with user therough script i am not sure how to pass the user name and password.Can ou modify the script and help me out.
Code:
#!/bin/bash
for filesize in $(ls -ltr | grep username | awk '{print $2}')
do
echo  `su -a ABC`
echo
done

Moderator's Comments:
Mod Comment Please use next time
code tags for your code and data
# 2  
Old 02-24-2012
Im sure there are alternatives:
What is you are trying to avoid?
What is this specific user? (a software ?)
Are are these processes?
killing at reboot is not "standard", Not letting such user connect or process to run till... is more...
# 3  
Old 02-24-2012
I just want to kill the process ids through script for the user ABC.
I wrote the script until selecting the process Ids for the user
But i am logging with some other user other than ABC.
While kill the process ids i have to login with the User respectively and killing when maually doing.
For example my user is : myadm i want to kill the process id of the user ABC.
So in script itself i have to switch the user respectively and killing process IDS.
This is my requirement.

If my script is not correct atleast some extend can you please modify the script and please let me know.

Thanks in advance.
# 4  
Old 02-24-2012
Is the command killall available on your system?
The following command should do what your script intends to do:
Code:
killall -u username

Like vbe, it is not clear to me what you try to accomplish...
# 5  
Old 02-24-2012
I checked not available.
Is there any way to kill all the process IDs for the specific user at a time?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cannot kill hacker process with my script

I want to kill a process of xterm that is run by hacker with my login name. So, I write a shell script to do my goal. I run 2 xterm and then I run my script on a first xterm. it should kill the process of a second xterm but it doesn't.Why? Here is my code : #!/bin/ksh myps=$(ps -f|grep... (7 Replies)
Discussion started by: thsecmaniac
7 Replies

2. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

3. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

4. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

5. Shell Programming and Scripting

script to loop all process ids and take pmap

Hi all, I need a script that will loop around all the current processes and take a pmap -x <process id> and output each pmap to a separate file. Would anyone have a quick command to do this? (2 Replies)
Discussion started by: borderblaster
2 Replies

6. Shell Programming and Scripting

Error in script to automate the daily monitoring process of UNIX server and it's proc

hi friends, I am trying to automate the daily monitoring process of UNIX server and it's processes. the script are below i executed the above script using ksh -x monitortest1.sh in root login . It shows error at some lines . 1. i logged in using root ,but it... (8 Replies)
Discussion started by: rdhaprakasam
8 Replies

7. Shell Programming and Scripting

Unix Script to find and kill a process with high memory utilization

Hi Unix Gurus i am somewhat new to unix scripting so need your help to create a script as below. # This script would find the process consuming memory beyond a certain #limit. if the meemory consumption is more than 100% for a period of 1 # minute for the specific process. the script would... (0 Replies)
Discussion started by: robinforlinux
0 Replies

8. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

9. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies

10. SCO

Identifiy and Kill Idle Unix(SCO) Process called externally

Hi, Please let us know of any possiblity of identifying and killing unix proces invoked externally (by an external tool which does not create a session). 'who' command gives idle time of sessions. But what we are looking for is idle time of a process. 'ps' command gives the elapsed/running... (1 Reply)
Discussion started by: vbalajis
1 Replies
Login or Register to Ask a Question