Score:1

How to execute bash file on Ubuntu Unity startup?

cn flag

After looking around for a bit on how to change my touchpad parameters automatically on booting up, I've found that I should be able to do this by creating the folder ~/.config/autostart in which I then create a touchpad.sh.desktop and a touchpad.sh file, where the first contains:

[Desktop Entry]
Type=Application
Exec=/home/jschoete/.config/autostart/touchpad.sh
X-GNOME-Autostart-enabled=true
Hidden=false
NoDisplay=false
Name[en_GB]=touchpad
Name=touchpad
Comment[en_GB]=natural scrolling and tap to click
Comment=natural scrolling and tap to click

and the latter:

#!/bin/bash

xinput set-prop 12 327 1
xinput set-prop 12 343 1

The latter file works as intended when executed manually, but it doesn't seem to get executed upon bootup, what is going wrong?

hr flag
@Rishon_JR most of the proposed solutions in that article look inappropriate to me, since afaik xinput needs a running X server
hr flag
Is the script executable, i.e. can you run it manually as `~/.config/autostart/touchpad.sh` or do you need to use `bash ~/.config/autostart/touchpad.sh`?
Rishon JR avatar
pl flag
What about this [article](https://www.golinuxcloud.com/run-script-at-startup-boot-without-cron-linux/)
Raffa avatar
jp flag
Change the whole command after `Exec=` to `sh -c 'sleep 10; xinput set-prop 12 327 1; xinput set-prop 12 343 1'` and see if that works ... See for example https://askubuntu.com/a/1450655
J. Schmidt avatar
cn flag
@Rishon_JR Obviously I did or I wouldn't be here.
J. Schmidt avatar
cn flag
@steeldriver this seemed to be the issue! I made it executable with chmod and now it worked after a reboot.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.