You are not logged in.
Hi,
I'm trying to stop (nicely) a xterm running a ncmpc from another termial. For scrpiting purposes.
So i thought it would be enought to send a 'q' character trought stdin.
this is what i'm testing
pc -C ncmpc # to grab the PID
once i've got the PID i try
echo -n q > /proc/PID/fd/0
but the progrma doesn't exits. (it prints the q on stdout)
Could somebody give advice on how to do this?
1) is this the best way ?(maybe kill -STOP PID is not bad if ncmpc handles it well)
2) or how do i echo the q?
regards
Last edited by pepeapepepe (2009-09-10 19:06:29)
.--.-.... --. .-.-.-..-.-..--....- .- .-...-... --..-..-... -.-.----. ..-.. ...------....-...-.-----..-- .-....---.-..- --. .-.-.-..-.-.--- .-...-... --..-..-... -.-.----. .-...- -......-...-...-..-..-
Offline
fd/1 doesn't work either.
killall ncmpc should work
With gdb you can run C code in the application, like ungetch('q')
$ gdb ncmpc PID
(gdb) call ungetch('q')
(gdb) detach
I'm not sure if there's a more convenient way for a bash script, but with a gdb script file it seems to work
call ungetch('q')
detach
quit
and run
gdb ncmpc $(pgrep ncmpc) --command=gdbsendq.txt
Offline
ok,
it worked fine,
that's a cool gdb feature i didn't knew about
thaks
.--.-.... --. .-.-.-..-.-..--....- .- .-...-... --..-..-... -.-.----. ..-.. ...------....-...-.-----..-- .-....---.-..- --. .-.-.-..-.-.--- .-...-... --..-..-... -.-.----. .-...- -......-...-...-..-..-
Offline