-
Senior Member
registered user
Locking the keyboard during a script command
.
I have a simple script that does some useful housekeeping jobs;
however, it will hang up and require a re-command if any keyboard activity
occurs during the small time it takes to perform the housekeeping jobs.
Are there some simple commands that would allow me to lock-out
the keyboard just before and re-activate the keyboard just after
the script operations are in process?
-
Senior Member
registered user

Originally Posted by
utu
.
I have a simple script that does some useful housekeeping jobs;
however, it will hang up and require a re-command if any keyboard activity
occurs during the small time it takes to perform the housekeeping jobs.
Are there some simple commands that would allow me to lock-out
the keyboard just before and re-activate the keyboard just after
the script operations are in process?
Are you referring to locking the keyboard when you are running the script from a lxterminal ( or any other terminal emulators ) or you want to lock the entire keyboard and mouse for the entire X Window session ? If it is the formal you can consider using nohup and redirect input to null.
$ nohup command arg ..... < /dev/null
If it is the latter, I am not aware of a way to do it. In LXDE, locking is easy but automatically unlock is tough.
-
Senior Member
registered user
@ kl522
I have a small /etc/rc.local script which does things at boot.
Takes about 60 seconds. Any keyboard activity at all prior to
its completion seems to reset the clock for another 60 second wait.
I thought there might be something like 'init x' added before
and 'init y' added after the script would lock out the keyboard
while the script is doing its thing.
This begs the question about what happens if the script itself
hangs up.
Last edited by utu; 05-13-2011 at 02:34 PM.
-
Senior Member
registered user

Originally Posted by
utu
@ kl522
I have a small /etc/rc.local script which does things at boot.
Takes about 60 seconds. Any keyboard activity at all prior to
its completion seems to reset the clock for another 60 second wait.
Try 'nohup', that's what it is meant for, making whatever script/command immune to standard input.
-
Senior Member
registered user
@ kl522
Took a few lines out of /etc/rc.local and made a separate
script called /etc/setup.
Replaced those lines in the original /etc/rc.local with
nohup /etc/setup &.
Keyboard input no longer upsets the process.
Thanks.
-
Senior Member
registered user
@ kl522
Two amendments:
(1) /etc/rc.local doesn't like the '&'; I've deleted it; and
(2) I've added '> /dev/null 2>&1' in its place to do away with
a lot of nohup messages showing up in home.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

GIGABYTE A520M DS3H AC AMD AM4 Motherboard mATX
$59.99

GIGABYTE Z790 AORUS ELITE AX LGA 1700 Intel Z790 ATX Motherboard with DDR5
$119.99

Corsair RMe RM850e 850W 80 Plus Gold Fully Modular Low Noise Certified Refurb
$56.99

Gigabyte GA-B85M-D3H Motherboard
$54.99

GIGABYTE B365 HD3 LGA1151 Intel 9th Gen motherboard
$59.99

Asus Prime B660M-A AC D4 Motherboard Intel LGA 1700 14th 13th 12th Gen DDR4
$79.99

Intel H81 Motherboard M.2 NVMe LGA 1150 mATX w/ IO Shield (Random Slot Color)
$29.90

ASUS PRIME H410M-K LGA 1200 Intel 10th Gen H410 DDR4 USB3.2 Motherboard M-ATX
$59.99

MSI Z590 PLUS Intel Z590 LGA1200 DDR4 ATX HDMI DP VGA Desktop Motherboard
$110.00

Dell XPS 8940 Desktop Motherboard Intel H470 LGA1200 DDR4 K3CM7 KV3RP 427JK
$154.99