Sponsored Content
Top Forums Shell Programming and Scripting how to kill process from file Post 83523 by naamas03 on Thursday 15th of September 2005 02:18:50 PM
Old 09-15-2005
Data how to kill process from file

i have a script that read a file which contains process_id and time that he's
in and it lookes like this
0:30 54545
0:44 66788
0:90 23233
i need to read every line in the file and get the time and if the process is greater then 0:30 to kill the process id
the script looks like this
cat bbb | while read line
do
#kill -9 $i
done
i don't how to take of the hour , ask about it and kill the process
can you please help me and another question
did i do the loop ok did i need the pipe before the while
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

how to kill process from file

hello i want to write a script in unix which read file that contains : hour and process_id like this file bbb: 0:30 6678 1:40 8789 and for every line he check if the hour greater then 30 minutes he kill the process_id the script looks like this cat bbb | while read line do ... (1 Reply)
Discussion started by: naamas03
1 Replies

2. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

3. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

4. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

5. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

6. Shell Programming and Scripting

kill process from a file or directly with top

i have edited a script to kill an exact mysql process is causing the high load on the server, my problem is, kill dont kill it! script: #!/bin/sh top -n 1 -u mysql | grep mysqld | awk '{print $1}' > pid proc='cat pid' kill -9 $proc or i try with kill -9 `top -n 1 -u mysql | grep mysqld... (8 Replies)
Discussion started by: chandro
8 Replies

7. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

8. Shell Programming and Scripting

Soft kill a process to redirect the last kbytes output to a file

Hey guys, I have a python script that I call with this line: python mypythonscript.py >> results.csv &The problem is that the redirection from the stdout to the file results.csv only writes 4096 kbyte blocks. So if i kill this process with kill the last kbytes that the script produce will... (6 Replies)
Discussion started by: Mastaer
6 Replies

9. Shell Programming and Scripting

How to kill the process when the file is locked?

I was trying to read the file to create a table in SAS and I got error as follows while I read. Resource is write-locked by another user. File =/usr/sas/sas_config/Lev1/SASApp/StoredProcessServ​er/Logs/SASApp_STPServer_2015-09-29_tmp_18208.log. System Error Code = 0. ERROR: File is in... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies

10. Shell Programming and Scripting

Shell script to report file size, pid and also kill the process

Hi All, Looking for a quick LINUX shell script which can continuously monitors the flle size, report the process which is creating a file greater than certain limit and also kill that process. Can someone please help me on this? (4 Replies)
Discussion started by: vasavimacherla
4 Replies
setpgid(2)							System Calls Manual							setpgid(2)

NAME
setpgid, setpgrp - Sets the process group ID SYNOPSIS
#include <unistd.h> int setpgid( pid_t process_id, pid_t process_group_id); pid_t setpgrp(void); Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these standards. The following alternate declaration for setpgrp() does not conform to current standards and is supported only for backward compatibility: int setpgrp( pid_t process_id, pid_t process_group_id); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: setpgid(): XSH5.0 setpgrp(): SVID 3, XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the ID of the process whose process group ID is to be changed. Specifies the new process group ID. DESCRIPTION
Use the setpgid() function to add a process to an existing process group or to create a new process group within a process's session. The setpgid() function does not change the process group ID of a session leader. The setpgid() function sets the process group ID of the process identified by the process_id parameter. The process group ID is set to the value specified in the process_group_id parameter. If the process_id parameter contains 0 (zero), the setpgid() function sets the process group ID of the calling process. The new value of the process group ID is the one specified in the process_group_id parameter. If the process_group_id parameter contains 0 (zero), the setpgid() function sets the process group ID of the specified process using the process group ID of the calling process. The specified process is the one identified by the process_id parameter. The setpgid() function supports job control. The setpgrp() function sets the process group ID of the calling process to be equal to the process ID of the calling process. If the func- tion creates a new session, the new session has no controlling terminal. This function does not change the process group ID of a session leader. NOTES
[Tru64 UNIX] When compiled in the X/Open UNIX environment, calls to the setpgrp() function are internally renamed by prepending _E to the function name. When you are debugging a module that includes the setpgrp() function and for which _XOPEN_SOURCE_EXTENDED has been defined, use _Esetpgrp to refer to the setpgrp() call. See standards(5) for further information. [Tru64 UNIX] The backward-compatible version of the setpgrp() function is supported for use outside of the System V habitat or X/Open- UNIX environment. This version of setpgrp( behaves like the setpgid() function. In this case, you specify a process ID and process group ID as parameters in the call to setpgrp(). The setpgrp() function does not change the process group ID of a session leader. RETURN VALUES
Upon successful completion, the setpgid() function returns a value of 0 (zero). Otherwise, the function returns a value of -1 and sets errno to indicate the error. Upon successful completion, the setpgrp() function returns the new process group ID. [Tru64 UNIX] The alternate version of setpgrp() returns a value of 0 (zero) on successful completion. Otherwise, the function returns a value of -1 and sets errno to indicate the error. ERRORS
The setpgid() function sets errno to the specified values for the following conditions: The value of the process_id parameter matches the process ID of a child process of the calling process and the child process has successfully executed one of the exec() functions. The value of the process_group_id parameter is less than or equal to 0 (zero), or is not a valid process ID. The value of the process_group_id parameter is a valid process ID, but that process is not in the same session as the calling process. The process indicated by the process_id parameter is a session leader. The value of the process_id parameter matches the process ID of a child process of the calling process and the child process is not in the same session as the calling process. The value of the process_group_id parameter is valid but does not match the process ID of the process indicated by the process_id parameter, and there is no process with a process group ID that matches the value of the process_group_id parameter in the same ses- sion as the calling process. The value of the process_id parameter does not match the process ID of the calling process or of a child process of the calling process. No errors are defined for the standard version of the setpgrp() function. [Tru64 UNIX] The backward-compatible version of setpgrp() sets errno to the same values as setpgid(). RELATED INFORMATION
Functions: exec(2), fork(2), getpid(2), getsid(2), kill(2) Standards: standards(5) Guides: Programmer's Guide delim off setpgid(2)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy