detect active ttys regardless if a process is attached to any.
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This will assume that there's a controlling process on each tty (except /dev/console): which should be the case, but might not be.
For using in a loop in rc.font though, I'm feeling it's over-engineered, and best just left to hard-coded values on the for, but it'd look something like this:
Code:
#!/bin/sh
#
# This selects your default screen font from among the ones in
# /usr/share/kbd/consolefonts.
#
font='ter-v24b'
active_ttys()
{
{
ps -Nd -o tty | grep tty[0-9]
sed -n '/tty[0-9]/ { s/^\(tty[0-9]*\)\(.*\)/\1/ ; p }' /proc/consoles
} | sort
}
for vc in $( active_ttys )
do
setfont -C /dev/$vc "$font"
done
If you "hardcode 1-8" into a for-loop in /etc/rc.d/rc.font, then I hope you also put a 'comment' into /etc/inittab for subsequent sys-admins about the gotcha lurking...
Quote:
Originally Posted by GazL
I'm just going to KISS and hardcode 1-8 on the for loop and leave it at that.
Whether a getty is running on it or not really isn't relevant here. What matters is which virtual consoles the admin/user wants the font applied to: which is handled by rc.font. So, no need for a comment in inittab; a comment in rc.font explaining should do the job.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.