Originally Posted by diemons
Tried the command "kill -l " buddy, but does'nt help.
My code looks as below:
All i need is to redirect the ouput of the file to another file(say log.txt) .When it tried this manually using "cat /proc/file_msgq > log.txt" ,then ctrl+c , log.txt file is created but empty .
Any clues ....
kill -l is meant to show you the available signals. The actual command you need is something like
where signal will be SIGINT and PID is the Process ID of the cat command. You can retrieve it using the ps command. Anyway, can you explain why you need to interrupt the cat command? I haven't got the file /proc/file_msgq on my system, so that I cannot test, but if it is a regular file it should be catted
in a glitch and the cat command should terminate. Unless it is a named pipe
: in this case cat waits for any stream of data flushing through the pipe.
Please, post the output of the following command:
to see what /proc/file_msgq actually is.
In addition, to get the PID of the process and kill it in one-shot you might try the pkill command:
pkill -SIGINT -f "cat /proc/file_msgq"
Please, see man pkill