Can't Figure out how to Script to run at Reboot on Ubuntu 20.04

Deo3560

New Member
Credits
41
Hi I'm working on a Panasonic Toughbook CF-31S MK3 and am working to get the Touchscreen to Calibrate automatically on startup. I have a script that works when run by itself, however I need to be able to have it run automatically on reboot/startup so that I don't have to manually run the script every time I boot up to Ubuntu.

Here is my script:
#!/bin/sh
# Coordinate touch panel to screen
xinput set-prop "Fujitsu Component USB Touch Panel" "Coordinate Transformation Matrix" 1.075, 0, -.03, 0, 1.1, -0.07, 0, 0, 1


I myself am quite new to linux, and have been using many different guides to try to get this to work, however to no avail, all my efforts have been fruitless. I've tried making it a Cron Job, Adding it using Systemd services, adding the xinput_calibrator output into /usr/share/xorg.conf.d/99-calibrations.conf file, generating a rc.local file and trying to startup using that, probably other things I can't particularly remember. All of these things, I am not entirely sure I am even doing correctly with my current linux experience. If someone knows a sure fire way to get this working or any suggestions, please leave a reply and in detail let me know what I need to do to get this thing to work so I don't need to run this every time I boot up please!

Thanks for any helpful input in advance!
 


Vrai

Well-Known Member
Credits
2,297
Hmmmmm...... this post got me to thinkin'.
I came across a post on Easy Linux Tips Project today about how to disable the "Caps lock" key.
My laptop does not have a light to indicate when Caps lock is turned on, which can be a PITA at times when entering passwords, so I have to open a text editor and type some letters to determine if it is on or off.
The Easy Linux Tips post shows how to disable the Caps lock with a simple command in Terminal BUT it does not survive a reboot.
The solution was to add the command to the "Startup" folder. Viola! Now that command will run every time I start the machine.

So, I am wondering if the same technique could be used to run your script each time at boot.

 

GilbertMint

New Member
Credits
10
Hi
One easy way is to use the lightdm manager that is installed by default.

Open a terminal ( ctrl alt t )
Enter command ( sudo pluma /etc/lightdm/lightdm.conf )
Enter you user password
Enter the following text if the file is empty, else [Seat:*] will already be there so no need to put.

[Seat:*]
session-setup-script=/home/username/bin/calibrate_screen.sh <-- put your path and script name


Save the file
Close the terminal
Reboot to test.

ps: if you need to run a script when you shutdown or reboot you system use:
( session-cleanup-script=/path/to/script/scriptname ) in the same script.

Have a nice day
Gilbert
 


Staff online

Members online


Latest posts

Top