[NTLUG:Discuss] Numlock on at boot

Greg Edwards greg at nas-inet.com
Thu Sep 5 23:05:08 CDT 2002


Merlin wrote:

> Simple/silly question time again, that I have not been able to find the answer 
> for.
> 
> How do I configure linux (Redhat 7.3) to turn on numlock at boot up?  I use my 
> numberpad way too much, and it is very annoying to have to remember to hit the 
> num lock key.
> 
> Thanks!!
> 
> 


Mandrake installs a numlock init script.

======================================================================

#!/bin/sh
#
# Startup script for NumLock
#
# description: Locks NumLock key at init runlevel change
# chkconfig: 345 85 15

# Source function library.
. /etc/rc.d/init.d/functions

# 
The following file make bash to relock the numlock key
# 
when logging
# 
since login unlock it.
SYSCONF_FILE=/var/lock/subsys/numlock
#SYSCONF_FILE=/etc/sysconfig/numlock

# See how we were called.
case "$1" in
   start)
	echo -n "Starting numlock: "
	echo_success
	echo
	touch $SYSCONF_FILE

	for tty in /dev/tty[1-8]; do
		setleds -D +num < $tty
	done

	;;
   stop)
	echo -n "Disabling numlocks on ttys: "
	for tty in /dev/tty[1-8]; do
		setleds -D -num < $tty
	done
	echo_success
	echo
	rm -f $SYSCONF_FILE
	;;
   status)
# 
status NumLock
# 
echo "dead status as reported is normal since NumLock
# 
doesn't need to daemonize"
	if [ -f $SYSCONF_FILE ]
	then
		echo "numlock is enabled"
	else
		echo "numlock is disabled"
	fi
	;;
   restart)
	$0 stop
	$0 start
	;;
   reload)
	echo -n "Reloading numlock: "
	$0 start
	echo
	;;
   *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 1
esac

exit 0


====================================================================================



-- 
Greg Edwards
New Age Software, Inc.
http://www.nas-inet.com





More information about the Discuss mailing list