linux - how to use kill SIGUSR2 in bash? -
i use iptraf monitor network traffic in linux, , shell command is(make iptraf running in background):
iptraf -s eth0 -f -b -l ./traffic.dat
if want result, have stop iptraf first, use shell command:
kill -sigusr2 $pid
however, not stop iptraf if move these shell commands bash script file(net.sh), , error:
kill: sigusr2: invalid signal specification
i use 'kill -l' in script file(net.sh), , find there no parameter name sigusr2. , nothing if use usr2 or -9.
the complete script file is:
iptraf -s eth0 -f -b -l ./temp.txt pid=`ps -ef | grep iptraf | grep -v grep | awk '{print $2}'` kill -usr2 $pid cat temp.txt
i nothing after these commands.
what shoud if want result?
sigusr2
architecture depended , can have value out of 31
, 12
or 17
. described in man 7 signal
. you'll have find out value appropriate system. done having into:
/usr/include/asm/signal.h
on system - ubuntu 12.04 amd 64 - has value of 12
:
#define sigusr2 12
once know proper numeric value sigusr2
on system, can send signal using:
kill -signo pid # in case kill -12 pid
Comments
Post a Comment