Score:3

Startup script not executing

al flag

Ubuntu Version: 22.04.1 LTS Hey! I'm trying to run startup.sh located in /root/startup.sh on startup. This is the content of the file:

synclient VertScrollDelta=-100
synclient CoastingFriction=35
synclient MinSpeed=0.05
synclient MaxSpeed=0.7
echo "All went according to plan..."

when I run the file manually using sudo /root/startup.sh then all goes according to plan, but after I wrote the following line in the thing that opens when you type crontab -e:

@reboot root sh /root/startup.sh >/dev/null 2>&1

and restarted my computer, nothing happened.I tried using this answer here, with the comment what you have to do on ubuntu.

Does anybody know how to fix this?

Logs:

Jan 17 11:04:10 sexy-cat-girl-computer CRON[1015]: (originalusernamelol) CMD (root sh /root/startup.sh >/dev/null 2>&1)

and with only @reboot root sh /root/startup.sh:

Jan 17 11:01:34 sexy-cat-girl-computer CRON[1026]: (originalusernamelol) CMD (root sh /root/startup.sh)
Jan 17 11:01:34 sexy-cat-girl-computer CRON[976]: (CRON) info (No MTA installed, discarding output)

I think discarding output isn't bad, right?

Marco avatar
br flag
How do you know "nothing happend" ? From my point of view everything looks as it should. The script is beeing executed on reboot.
User1986 avatar
al flag
This script is supposed to fix my light-speed touchpad, caused by awful default settings. If I run the script manually, it fixes it until rebooted. If instead I reboot, the settings go to default, instead of being changed by the script. I can confirm this by using `synclient -l` and seeing that all the variables are not what I wanted them to be in the script (for example MinSpeed=0.05, but its the default setting of MinSpeed=1). Do you know what might be causing this?
Marco avatar
br flag
Don't ask for something else than you try to solve! You asked "why is this stript not execured", but you wanted to solve a problem with your touchpad.
User1986 avatar
al flag
Marco... I already solved the problem with my touchpad. The solution is this script. Anything else I tried to solve the touchpad problem, including asking about the touchpad problem several times, has not solved the touchpad problem, or made the touchpad problem better. The touchpad problem is dangerous. When I asked the oracle about it, it told me to use the syncclient function, and that worked.
hr flag
You don't need the username (`root`) inside a regular crontab, that's just for the systemwide `/etc/crontab` (in fact it's an error - you can see from the log message `CMD (root sh /root/startup.sh)` that it's interpreting `root` as a command)
Score:5
jp flag

Your commands to manipulate the touchpad's settings require an X server user session already running which is not the case during boot nor for the root user on Ubuntu.

The best way to run such a script is to save it under your regular user e.g. in your home directory and run it as a startup application ... or you can just nest all the commands in a sh command string like so:

sh -c 'sleep 10; synclient VertScrollDelta=-100; synclient CoastingFriction=35; synclient MinSpeed=0.05; synclient MaxSpeed=0.7'

and run it as a startup application i.e. like this example ... The sleep 10 call might be needed to allow the session fully load for ten seconds(you can shorten it if your desktop loads quicker to e.g. three seconds i.e. sleep 3 instead) before the commands are run.

Score:0
cn flag

You execute the command as the root user, not your regular user account. Tis probably has the effect that the configuration is performed for the root-user. Try to use your touchpad as the root user and it will probably work. Or change the line in the crontab to reflect and use the normal user account. E.g.: @reboot [insertyourordinaryusernamehere] sh /root/startup.sh >/dev/null 2>&1

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.