2

I connect to Internet using sudo wvdial on Fedora 14. The terminal needs to be kept working. My requirement is to run yum update in a separate terminal, then kill wvdial & its parent terminal and do init 0 in a single command using su -c.

Is there a way to kill child (here, sudo wvdial) and parent (here, terminal running wvdial) with a single command which can let me do the following?

su -c 'yum update; kill-child-parent-processes; init 0'

Here kill-child-parent-processes signifies the method using which I can kill sudo wvdial and its parent terminal.

Thanks.

1 Answer 1

1

You need to find out the session ID (sid) of the shell running in the terminal.

jinx:802 Z$ ps -p$$ -o sid
 SESS
17424

(Pedantry alert: usually this is the same as $$. If it's different then this may not work.) You can then use this to kill the session running in the terminal. You can't kill the terminal directly this way (it's in the window manager's session), but if the terminal is set to auto-close (as it usually is) then it will go away by itself.

jinx:803 Z$ pkill -s 17424

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.