Sponsored Content
Top Forums Shell Programming and Scripting Kill -9 within Bash script kicks out usage info Post 302332621 by vgersh99 on Thursday 9th of July 2009 03:35:40 PM
Old 07-09-2009
There's a bash builtin 'kill' which is different from the '/usr/bin/kill'.
Also when you do 'sudo' it most likely defaults to '/bin/sh' which has no builtin 'kill'.
The 'signatures' for '/usr/bin/kill' and bash's builtin 'kill' are different.
'man bash':
Code:
     kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
     kill -l [sigspec | exit_status]
          Send the signal named  by  sigspec  or  signum  to  the
          processes named by pid or jobspec.  sigspec is either a
          signal name such as SIGKILL or a signal number;  signum
          is  a  signal number.  If sigspec is a signal name, the
          name may be given with or without the SIG  prefix.   If
          sigspec  is  not  present, then SIGTERM is assumed.  An
          argument of -l lists the signal names.   If  any  argu-
          ments  are  supplied when -l is given, the names of the
          signals corresponding to the arguments are listed,  and
          the return status is 0.  The exit_status argument to -l
          is a number specifying either a signal  number  or  the
          exit  status of a process terminated by a signal.  kill
          returns true if at least one  signal  was  successfully
          sent,  or false if an error occurs or an invalid option
          is encountered.


Last edited by vgersh99; 07-09-2009 at 04:43 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

diskspace usage info

Anybody can help me? I need to know a specified folder diskspace usage, that's how much bytes that folder and its files/folders below spend on my storage. Thanks (2 Replies)
Discussion started by: nusajunus
2 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. UNIX for Dummies Questions & Answers

kill/pkill process by CMD info.

I have a process that I'd like to kill. Doing a "ps -fu myusername" gives me: UID PID PPID C STIME TTY TIME CMD myusername 5443 1 0 10:05 ? 00:00:00 /bin/sh /some/path/crap.sh -s /yet/another/path/parentProcess myusername 5593 5443 0 ... (2 Replies)
Discussion started by: mrwatkin
2 Replies

4. Shell Programming and Scripting

Help with bash script - Need to get CPU usage as a percentage

I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies

5. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

6. Shell Programming and Scripting

Bash script show Kill system output

Hi we are calling kill -9 $pid command from bash script it gives below output, but we need to hide the output. i tried /dev/null but ni luck. is there any alternate way to schive this. ../kill_scr.sh: line 42: 1891 Killed /tmp/anr_rest_mul_wc.sh Soalris 10. ... (2 Replies)
Discussion started by: sachinbutala
2 Replies

7. UNIX for Dummies Questions & Answers

usage of kill

i'm writing a code that passes the shells process id and the time set till the pid is killed. the argument from the terminal looks like this: ./timeout $$ 4 now $$ specifies the shell pid, how can insert that to kill(pid,signum) as an parameter? (0 Replies)
Discussion started by: l flipboi l
0 Replies

8. SCO

Console GUI kicks me after 30 seconds. Licensing issue?

I have two SCO servers. On one I can logon to the gui via console with no problem. However, on the other I can logon to the gui but after a few seconds it kicks me back out to the prompt. I asked previous admin about this and he seems to think its a license issue? (7 Replies)
Discussion started by: herot
7 Replies

9. Shell Programming and Scripting

Bash Info Display

I have written the following bash function prArgv Suppose the calling sequence is as follows prArgv VAL1 VAL2 DESC VAL3 VAL4 v2d1 s4 p15 The call will look at the tag k1v2, add the numbers together, in this case 2+1=3 This means that the function will look at the first 3 user arguments... (1 Reply)
Discussion started by: kristinu
1 Replies

10. UNIX for Dummies Questions & Answers

Kill a program from bash

to kill a program in bash, for instance 'mousepad' I use kill $(pidof mousepad); or pkill mousepad But it only works if we use another bash window; If it is started from the same bash, that does not work: #mousepad;kill $(pidof mousepad); In this case, it looks like mousepad hangs... (7 Replies)
Discussion started by: arpagon
7 Replies
KILL(1) 						    BSD General Commands Manual 						   KILL(1)

NAME
kill -- terminate or signal a process SYNOPSIS
kill [-s signal_name] pid ... kill -l [exit_status] kill -signal_name pid ... kill -signal_number pid ... DESCRIPTION
The kill utility sends a signal to the processes specified by the pid operand(s). Only the super-user may send signals to other users' processes. The options are as follows: -s signal_name A symbolic signal name specifying the signal to be sent instead of the default TERM. -l [exit_status] If no operand is given, list the signal names; otherwise, write the signal name corresponding to exit_status. -signal_name A symbolic signal name specifying the signal to be sent instead of the default TERM. -signal_number A non-negative decimal integer, specifying the signal to be sent instead of the default TERM. The following pids have special meanings: -1 If superuser, broadcast the signal to all processes; otherwise broadcast to all processes belonging to the user. Some of the more commonly used signals: 1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal) Some shells may provide a builtin kill command which is similar or identical to this utility. Consult the builtin(1) manual page. SEE ALSO
builtin(1), csh(1), killall(1), ps(1), kill(2), sigaction(2) STANDARDS
The kill function is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. HISTORY
A kill command appeared in Version 6 AT&T UNIX. BUGS
A replacement for the command ``kill 0'' for csh(1) users should be provided. BSD
April 28, 1995 BSD
All times are GMT -4. The time now is 06:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy