0

as title says I have a centOS 6 machine which uses an dracut, initramfs preboot ssh. I want to create a shell script that at the end of it's execution it closes the console and ssh connection. How can I do that. Escape character ~. does not work.

codiac
  • 659
  • 1
  • 5
  • 8

1 Answers1

0

You have to determine PID of shell started after SSH-session has been established - and kill it. SSH session terminates automatically. Most shells has variable $$ that contains PID of parent shell. So just add to your script last line:

kill -6 $$
Kondybas
  • 6,864
  • 2
  • 19
  • 24