LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2016, 02:08 PM   #1
mamosley
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 03-22-2016, 03:09 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
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.
 
Old 03-23-2016, 09:00 AM   #3
mamosley
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by grail View Post
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.
 
Old 03-23-2016, 11:00 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
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.
 
Old 03-23-2016, 04:56 PM   #5
mamosley
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by grail View Post
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
 
Old 03-24-2016, 07:37 AM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
/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
 
1 members found this post helpful.
Old 03-24-2016, 02:28 PM   #7
mamosley
LQ Newbie
 
Registered: Mar 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks much for your help, it is appreciated.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL 6.2: PPTP server communication issues from ppp session to local machine. Leigh507 Linux - Server 1 01-12-2012 04:08 PM
ssh - using variables in call to start remote script from local script babag Linux - Networking 2 06-03-2008 05:50 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 11:00 AM
rc.local problem in RHEL 4 penguin_powered Red Hat 3 10-07-2006 10:08 AM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 08:20 AM


All times are GMT -5. The time now is 07:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration