Results 1 to 6 of 6

Thread: Locking the keyboard during a script command

  1. #1
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631

    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?

  2. #2
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by utu View Post
    .
    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.

  3. #3
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    @ 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.

  4. #4
    Senior Member registered user
    Join Date
    Dec 2009
    Posts
    423
    Quote Originally Posted by utu View Post
    @ 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.

  5. #5
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    @ 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.

  6. #6
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    @ 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
  •  


Lot Of 16 X 16GB ECC DIMM Server Memory SK Hynix HMA42GR7MFR4N-TF PC4-17000 DDR4 picture

Lot Of 16 X 16GB ECC DIMM Server Memory SK Hynix HMA42GR7MFR4N-TF PC4-17000 DDR4

$800.00



TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot picture

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot

$471.39



1 PC MS 2024 Office USB STANDALONE COMPLETE FULL VERSION PACK picture

1 PC MS 2024 Office USB STANDALONE COMPLETE FULL VERSION PACK

$69.99



Lot Of 4 NEW SAMSUNG 16GB PC4-2933Y-RC2-12-DC1 Memory picture

Lot Of 4 NEW SAMSUNG 16GB PC4-2933Y-RC2-12-DC1 Memory

$299.00



Corsair Vengeance 32GB (2x16GB) RAM DDR5 6000MHz CMK32GX5M2B6000Z30 picture

Corsair Vengeance 32GB (2x16GB) RAM DDR5 6000MHz CMK32GX5M2B6000Z30

$329.99



32GB  (2X16GB)  LOT 2  MTA16ATF2G64HZ-2G6E3 DDR4 PC4-2666V  Memory iMAC A1417 picture

32GB (2X16GB) LOT 2 MTA16ATF2G64HZ-2G6E3 DDR4 PC4-2666V Memory iMAC A1417

$110.00



HMAA8GR7AJR4N-XN SK Hynix 64GB PC4-25600 DDR4-3200MT/s 2Rx4 ECC Memory picture

HMAA8GR7AJR4N-XN SK Hynix 64GB PC4-25600 DDR4-3200MT/s 2Rx4 ECC Memory

$725.00



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$369.59



3 Sticks - Samsung M393A2G40EB1-CRC0Q 16GB 2Rx4 PC4-2400T ECC Server RAM PC4 picture

3 Sticks - Samsung M393A2G40EB1-CRC0Q 16GB 2Rx4 PC4-2400T ECC Server RAM PC4

$239.95



10 Sticks - 3x Samsung 2x SK Hynix 5x Micron 4GB 1Rx8 PC4-2133P RAM PC4 DDR4 picture

10 Sticks - 3x Samsung 2x SK Hynix 5x Micron 4GB 1Rx8 PC4-2133P RAM PC4 DDR4

$149.95