LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   close open tty (https://www.linuxquestions.org/questions/linux-software-2/close-open-tty-4175496477/)

nsic 02-27-2014 08:30 PM

close open tty
 
hi

i have a created a service in Fedora 19 with following data inside

[Unit]
Description=Autologin Service
Before=getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service

[Service]
Type=Simple
ExecStart=/usr/sbin/mingetty --autologin root --loginprog=/usr/bin/startx.autologin --noclear tty7 38400

Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target


my problem is when I stop the service the open tty7 is still open. I want it to be inaccessible when i stop the service.

nsic 02-28-2014 01:11 AM

I have done a work around on this



/sbin/agetty --noclear tty7 38400 linux &
PID=`ps -ax | grep tty7 | grep agetty | awk '{print $1}'`
kill -9 $PID
deallocvt 7

pan64 02-28-2014 02:32 AM

that is a single pkill command (like this):
pkill -9 -f 'agetty.*tty7'
but you should try it with pkill -15 or pkill -2 instead of -9


All times are GMT -5. The time now is 11:34 AM.