LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rhel 6.7 rc.local script issues (https://www.linuxquestions.org/questions/linux-newbie-8/rhel-6-7-rc-local-script-issues-4175575610/)

mamosley 03-22-2016 01:08 PM

Rhel 6.7 rc.local script issues
 
Hello,

I'm having a basic issue with the /etc/rc.local script. I recently migrated to a Lenovo T450, and found that I really dislike the large touchpad as it interferes with my typing. There's a command that I can run to disable the thinkpad: input set-prop `xinput | grep "Synaptics" | awk -F\= '{print $2}'| awk '{print $1}' ` "Device Enabled" 0
This command works fine, but doesn't seem to execute (at least properly) when I throw it in the rc.local init script. Here is the init script in its entirety:


#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

#Disables touchpad
xinput set-prop `xinput | grep "Synaptics" | awk -F\= '{print $2}'| awk '{print $1}' ` "Device Enabled" 0

touch /var/lock/subsys/local



The file is owned by root, and permissions are set at the default 755. I can't think of what would be causing the script to fail, so any help would be greatly appreciated!

I've modified the BIOS settings to disable the touchpad, but this doesn't work either.

grail 03-22-2016 02:09 PM

Normally for doing rc or cron type work I find it is best to give the full path to all commands.
I would add that there is definitely no reason to use grep and multiple awks when a single awk can do the job. (not using xinput I would need to see the output to improve the script).
I also assume you have this script in the correct directory and set to the appropriate level.

mamosley 03-23-2016 08:00 AM

Quote:

Originally Posted by grail (Post 5519846)
Normally for doing rc or cron type work I find it is best to give the full path to all commands.
I would add that there is definitely no reason to use grep and multiple awks when a single awk can do the job. (not using xinput I would need to see the output to improve the script).
I also assume you have this script in the correct directory and set to the appropriate level.

Here is the result of xinput list:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=13 [slave pointer (2)]
⎜ ↳ Macintosh mouse button emulation id=14 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=6 [slave keyboard (3)]
↳ Lid Switch id=7 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=8 [slave keyboard (3)]
↳ Sleep Button id=10 [slave keyboard (3)]
↳ Video Bus id=11 [slave keyboard (3)]
↳ Power Button id=12 [slave keyboard (3)]
↳ Integrated Camera id=9 [slave keyboard (3)]

The process I am interested in scripting to kill at launch is the Sypatics Touchpad. The scripts written above will kill the process, but when thrown into the rc.local it doesn't seem to execute.

grail 03-23-2016 10:00 AM

So I would change the below as shown:
Code:

xinput set-prop `xinput | grep "Synaptics" | awk -F\= '{print $2}'| awk '{print $1}' ` "Device Enabled" 0

xinput set-prop $(xinput | awk -F= '/Synaptics/{print gensub(/[^0-9].*/,"",1,$2)}') "Device Enabled" 0

As for testing the rc.local option, maybe try touching a file in /tmp and see if it is there after boot.

mamosley 03-23-2016 03:56 PM

Quote:

Originally Posted by grail (Post 5520228)
So I would change the below as shown:
Code:

xinput set-prop `xinput | grep "Synaptics" | awk -F\= '{print $2}'| awk '{print $1}' ` "Device Enabled" 0

xinput set-prop $(xinput | awk -F= '/Synaptics/{print gensub(/[^0-9].*/,"",1,$2)}') "Device Enabled" 0

As for testing the rc.local option, maybe try touching a file in /tmp and see if it is there after boot.

Thanks much for your reply. I am not too familiar with awk... Would you mind telling me what this portion of your script does?
Code:


awk -F= '/Synaptics/{print gensub(/[^0-9].*/,"",1,$2

Thanks again

grail 03-24-2016 06:37 AM

/Synaptics/ - Find lines with this word one them

print gensub(/[^0-9].*/,"",1,$2) - If above is true, remove everything from first non-digit onwards and return to print

mamosley 03-24-2016 01:28 PM

Thanks much for your help, it is appreciated.


All times are GMT -5. The time now is 10:42 PM.