BMX Bicycle freestyle
BMX Bicycle freestyle

Sunday, May 31, 2009

end program from terminal without loosing data

to end process softly run:

(ps ax | grep -v grep | grep transmission)
if [ "$?" -eq 0 ];
then
b=$(xwininfo -name Transmission | grep Window\ id:\ | awk '{print $4}')
xvkbd -xsendevent -window $b -text "\Cq"
fi


explanation and what to replace:

(ps ax | grep -v grep | grep transmission)
if [ "$?" -eq 0 ];

then
b=$(xwininfo -name Transmission | grep Window\ id:\ | awk '{print $4}') xvkbd -xsendevent -window $b -text "\Cq"
fi




legend:
will check if process is running (othwerwise virtual keyboard will hang)
will get programs window id and send keystroke \Cq = Ctrl + q stands for quit
Transmission to get window name do: 1. xwininfo in console 2. click on window 3.read window name in console (if ti names uses spaces use \ before each space )
transmission this can be found when running ps ax in terminal

special note: install xvkbd about 6Mb space lovely app

0 comments:

Post a Comment