Unix Technical Forum

Re: NumLoc "ON" at startup

This is a discussion on Re: NumLoc "ON" at startup within the Linux Operating System forums, part of the Unix Operating Systems category; --> R@LF wrote: > I am going in circles and cannot figure out how I can get my NumLoc on ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 06:23 AM
AAW
 
Posts: n/a
Default Re: NumLoc "ON" at startup

R@LF wrote:

> I am going in circles and cannot figure out how I can get my NumLoc on
> at startup. I use RH9 and XFree86 4.3.0-2
> I am not into kernel building ... there should be another simpler
> way(?) to do this.
>
> Rolf


Below is Mandrake's /etc/init.d/numlock. Double check file locations,
word wrap, etc., but it ought to be adaptable to Red Hat.

---------<CUT HERE>---------
#!/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)
gprintf "Starting numlock: "
echo_success
echo
touch $SYSCONF_FILE

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

;;
stop)
gprintf "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
# gprintf "dead status as reported is normal since NumLock doesn't
need to daemonize\n"
if [ -f $SYSCONF_FILE ]
then
gprintf "numlock is enabled\n"
else
gprintf "numlock is disabled\n"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
gprintf "Reloading numlock: "
$0 start
echo
;;
*)
gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
exit 1
esac

exit 0
---------<CUT HERE>---------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 06:23 AM
Bit Twister
 
Posts: n/a
Default Re: NumLoc "ON" at startup

On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
> R@LF wrote:
>
>> I am going in circles and cannot figure out how I can get my NumLoc on
>> at startup. I use RH9 and XFree86 4.3.0-2
>> I am not into kernel building ... there should be another simpler
>> way(?) to do this.
>>
>> Rolf

>
> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
> word wrap, etc., but it ought to be adaptable to Red Hat.
>
> ---------<CUT HERE>---------
> #!/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)
> gprintf "Starting numlock: "
> echo_success
> echo
> touch $SYSCONF_FILE
>
> for tty in /dev/tty[1-8]; do
> setleds -D +num < $tty
> done
>
> ;;
> stop)
> gprintf "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
> # gprintf "dead status as reported is normal since NumLock doesn't
> need to daemonize\n"
> if [ -f $SYSCONF_FILE ]
> then
> gprintf "numlock is enabled\n"
> else
> gprintf "numlock is disabled\n"
> fi
> ;;
> restart)
> $0 stop
> $0 start
> ;;
> reload)
> gprintf "Reloading numlock: "
> $0 start
> echo
> ;;
> *)
> gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
> exit 1
> esac
>
> exit 0
> ---------<CUT HERE>---------



Mandrake also has this file in /etc/profile.d/numlock.sh

-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
# Linux-Mandrake configuration.
# ReLock the NumLock key if /etc/rc.d/init.d/numlock has been runned
# This is needed as login reset the tty

MY_TTY=`tty`
case $MY_TTY in
/dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num < $MY_TTY;;
esac
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 06:23 AM
AAW
 
Posts: n/a
Default Re: NumLoc "ON" at startup

Bit Twister wrote:

> On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
>> R@LF wrote:
>>
>>> I am going in circles and cannot figure out how I can get my NumLoc
>>> on at startup. I use RH9 and XFree86 4.3.0-2
>>> I am not into kernel building ... there should be another simpler
>>> way(?) to do this.
>>>
>>> Rolf

>>
>> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
>> word wrap, etc., but it ought to be adaptable to Red Hat.
>>
>> ---------<SNIP>---------

>
>
> Mandrake also has this file in /etc/profile.d/numlock.sh
>
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
> # Linux-Mandrake configuration.
> # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been
> # runned This is needed as login reset the tty
>
> MY_TTY=`tty`
> case $MY_TTY in
> /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num <
> $MY_TTY;;
> esac
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----


Thanks for catching that, Bit Twister. I posted without double-checking
my facts.

Rolf, digging a little deeper, I see that both files are part of
Mandrake's numlock rpm, which include several more files. I don't know
enough about Red Hat's file structure to be sure about compatibility,
but you might try rebuilding the Mandrake SRPM (try rpmfind.net to
locate) for your system. OTOH, Florian H.R.'s suggestion would probably
be quicker and easier.

Good Luck,
Arn

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 06:24 AM
Doug Laidlaw
 
Posts: n/a
Default Re: NumLoc "ON" at startup

AAW wrote:

> Bit Twister wrote:
>
>> On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
>>> R@LF wrote:
>>>
>>>> I am going in circles and cannot figure out how I can get my NumLoc
>>>> on at startup. I use RH9 and XFree86 4.3.0-2
>>>> I am not into kernel building ... there should be another simpler
>>>> way(?) to do this.
>>>>
>>>> Rolf
>>>
>>> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
>>> word wrap, etc., but it ought to be adaptable to Red Hat.
>>>
>>> ---------<SNIP>---------

>>
>>
>> Mandrake also has this file in /etc/profile.d/numlock.sh
>>
>> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
>> # Linux-Mandrake configuration.
>> # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been
>> # runned This is needed as login reset the tty
>>
>> MY_TTY=`tty`
>> case $MY_TTY in
>> /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num <
>> $MY_TTY;;
>> esac
>> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----

>
> Thanks for catching that, Bit Twister. I posted without double-checking
> my facts.
>
> Rolf, digging a little deeper, I see that both files are part of
> Mandrake's numlock rpm, which include several more files. I don't know
> enough about Red Hat's file structure to be sure about compatibility,
> but you might try rebuilding the Mandrake SRPM (try rpmfind.net to
> locate) for your system. OTOH, Florian H.R.'s suggestion would probably
> be quicker and easier.
>
> Good Luck,
> Arn

I am using KDE as my WM. It is configured in there. I understand that
Numloc cannot be enabled at the login screen - apparently for security
reasons.

Doug.
--
Registered Linux user No. 277548.
Linux: in a world without fences, who needs Gates?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 06:34 AM
R@LF
 
Posts: n/a
Default Re: NumLoc "ON" at startup

On Fri, 25 Jul 2003 15:02:08 +0000, Bit Twister wrote:

> On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
>> R@LF wrote:
>>
>>> I am going in circles and cannot figure out how I can get my NumLoc on
>>> at startup. I use RH9 and XFree86 4.3.0-2
>>> I am not into kernel building ... there should be another simpler
>>> way(?) to do this.
>>>
>>> Rolf

>>
>> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
>> word wrap, etc., but it ought to be adaptable to Red Hat.
>>
>> ---------<CUT HERE>---------
>> #!/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

[snip]
[snip]
>> ---------<CUT HERE>---------

>
>
> Mandrake also has this file in /etc/profile.d/numlock.sh
>
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
> # Linux-Mandrake configuration.
> # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been runned
> # This is needed as login reset the tty
>
> MY_TTY=`tty`
> case $MY_TTY in
> /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num < $MY_TTY;;
> esac
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----


Well.... I got the startup script working
You forgot to tell me that I should do a "chkconfig numlock" to get it
started.
Good thing too, now I know how things work with the script-stuff...cool.

Now the numloc goes off again when I start X (Gnome).
When I logout of X, the numlock comes ON again.

I did not do anything special with the 2nd script (Linux-Mandrake config).
Does that has an activation like "chkconfig" too ?
Is it part of another script ?

Note, that I changed the path of /etc/sysconfig/numlock to
/var/lock/subsys/numlock to match my file locations.

Do I miss something ?

Rolf







Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com