I want to sent a SIGNAL to a process after .5 seconds.
Maybe this is not a good idea to do but I want to do it for an uncommon temporary case.
I tried like following, but its not working.
(sleep .5;kill -9)| some_process
Signals aren't directed to pipes; they're directed to process identifiers (pids). I might try something like this:
some_process & sleep .5; kill -KILL $!
which would run some_process in the background (that's what the & is for). After half a second, it will used the variable $! which indicates the pid of the last backgrounded process.
(Although sleep on some systems only accepts an integer.)
sleep .5; kill -9 $(pidof some_process) should work. pidof returns a process id for a process name. The $() returns the result of the command to the kill command. An alternative would be:
sleep .5; pidof some_process | xargs kill -9
check man pidof for details.
Edit: there is also timeout. timeout -s SIGKILL 0.5s some_process should do the trick if I understood your question correctly.
PIPE. This some_process is not a different process.some_process. So need to sent SIGNAL through pipe to some_process0.5 seconds? Maybe man timeout helps here? timeout -k e.g.?