Need help to script!!!! new to linux

Forum rules
Before you post please read how to get help
RodimusPrime81
Level 1
Level 1
Posts: 4
Joined: Sun Oct 22, 2017 11:15 pm

Need help to script!!!! new to linux

Postby RodimusPrime81 » Sun Oct 22, 2017 11:26 pm

Hello everyone need some help to script this command to the start up but I am very new to Linux Mint and to Linux in general. I am learning as I go. I have a touch screen issue and when I calibrate it with the command when i restart the machine it will make me do it again. here is the command I want to script:
xinput map-to-output 13 eDP1
I know how to use terminal a little bit but I don't much about where to put the scripts etc. Really I don't even know how to add that command to a script either.
Please help

User avatar
catweazel
Level 10
Level 10
Posts: 3451
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Need help to script!!!! new to linux

Postby catweazel » Mon Oct 23, 2017 1:35 am

Issue this command in a terminal:

Code: Select all

sudo nano -w /etc/rc.local

Paste your code into /etc/rc.local before the line that reads exit 0

ctrl-o + enter to save, ctrl-x to exit.

Finally, issue this command then reboot.

Code: Select all

sudo chmod +x /etc/rc.local

Make a backup of /etc/rc.local just in case the file gets overwritten by some wayward update.
If your problem is fixed, please mark your thread as [SOLVED] by editing the title of the first message in the thread.

rene
Level 6
Level 6
Posts: 1357
Joined: Sun Mar 27, 2016 6:58 pm

Re: Need help to script!!!! new to linux

Postby rene » Mon Oct 23, 2017 5:46 pm

The previous suggestion is unfortunately not going to work; xinput communicates with the X server, and at rc.local time there is not yet any such thing.

There's a few opportunities for running X startup scripts and the one I'd tend to like best is creating a file /etc/X11/Xsession.d/10custom_map-to-output containing

Code: Select all

[ -x /usr/bin/xinput ] && /usr/bin/xinput map-to-output 13 eDP1

Other opportunities are the display manager's scripts (which would necessitate you telling us in detail which version of Mint you are running) or even the desktop startup applications. The latter would cause the command to be run on login which may be late or too late. Note, I clearly can't test your specific command/issue; it might be the case that you in fact need it as a display manager script if your issue is of a nature where you need this soonest.

rene
Level 6
Level 6
Posts: 1357
Joined: Sun Mar 27, 2016 6:58 pm

Re: Need help to script!!!! new to linux

Postby rene » Wed Oct 25, 2017 6:40 am

Lack of reply and rereading has me wonder if it's useful to provide extra detail. To create mentioned file you can paste into a terminal:

Code: Select all

echo '[ -x /usr/bin/xinput ] && /usr/bin/xinput map-to-output 13 eDP1' | sudo tee /etc/X11/Xsession.d/10custom_map-to-output

After, verify the file to exist and display its contents with

Code: Select all

cat /etc/X11/Xsession.d/10custom_map-to-output

RodimusPrime81
Level 1
Level 1
Posts: 4
Joined: Sun Oct 22, 2017 11:15 pm

Re: Need help to script!!!! new to linux

Postby RodimusPrime81 » Sat Dec 09, 2017 1:47 am

I have tried the first answer to the question and i didnt work, Idk maybe i missed something but i did follow the instructions. thanks for the advice tho

RodimusPrime81
Level 1
Level 1
Posts: 4
Joined: Sun Oct 22, 2017 11:15 pm

Re: Need help to script!!!! new to linux

Postby RodimusPrime81 » Sat Dec 09, 2017 1:53 am

I have Tried the last Answer to my question and it seem to work I will keep you posted sorry for my delay in replying I have been very busy with work and school to even get on my machine. Thank you for you help


Return to “Scripts & Bash”