Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 575  / 2 Years ago, mon, june 6, 2022, 5:37:49

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?


More From » scripts

 Answers
4

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.


[#67] Wednesday, June 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
odenanno

Total Points: 207
Total Questions: 113
Total Answers: 94

Location: South Korea
Member since Sat, Oct 2, 2021
3 Years ago
odenanno questions
;