Jump to content

I need 2 things to be typed into the terminal every time I boot up my PC to turn off mouse acceleration and to enable the use of the scroll lock key so i can turn on the back light for my keyboard.

 

I need to put..

 

xmodmap -e 'add mod3 = Scroll_Lock'

 

and

 

xinput set-prop 11 279 -1

 

I have no idea how to make a script to do this automatically so some help would be much appreciated.

Link to comment
https://linustechtips.com/topic/736086-how-to-create-startup-scripts-in-ubuntu/
Share on other sites

Link to post
Share on other sites

1 minute ago, zMeul said:

add them to the /etc/rc.local ??!

I have no idea what that is. I hardly understand how the file structure works in Linux yet.

Link to post
Share on other sites

1 minute ago, Vincent__Thunder said:

you need to edit your crontab

cron -e (crontab -edit)

sudo if you need to use is system wide

 

But will that allow me to run terminal command at startup?

Link to post
Share on other sites

1 minute ago, zMeul said:

rc.local is a file in the /etc/ directory

What does it do?

Link to post
Share on other sites

2 minutes ago, Kilobytez95 said:

What does it do?

https://unix.stackexchange.com/questions/49626/purpose-and-typical-usage-of-etc-rc-local

 

Quote

The script /etc/rc.local is for use by the system administrator. It is traditionally executed after all the normal system services are started, at the end of the process of switching to a multiuser runlevel. 

 

Link to post
Share on other sites

5 minutes ago, deXxterlab97 said:

Also to change mouse acceleration follow this guide

https://askubuntu.com/questions/205676/how-to-change-mouse-speed-sensitivity

Just quickly tried all 3 of the options and none of them seemed to work for me.

Link to post
Share on other sites

2 minutes ago, Vincent__Thunder said:

what do you need to run when u start your linux box?

 

Read my post.

Link to post
Share on other sites

2 minutes ago, Vincent__Thunder said:

did u try sudo -i

and than put in in your crontab, at the time settings just a star ( * ) total of 5 stars

* * * * *  xmodmap -e 'add mod3 = Scroll_Lock

this wil run that every time (almost no cpu hit)

 

I'll try that and see if it works after I reboot.

Link to post
Share on other sites

7 minutes ago, Kilobytez95 said:

Just quickly tried all 3 of the options and none of them seemed to work for me.

http://askubuntu.com/questions/698961/disable-mouse-acceleration-in-ubuntu-15-10

and make 2 different startup app

15 minutes ago, deXxterlab97 said:

Find this Startup applications

Then name it something spooky

Copy xmodmap -e 'add mod3 = Scroll_Lock' 

Under command (or you can make a bash file)

 

 

Link to post
Share on other sites

Hi!

 

TL;DR: deXxterlab97s suggestion is most correct, IMO (some suggestions above should/might not work at all!)

 

There are several ways to run stuff/scripts/programs "at startup". I would consider this rough division:

  1. System-wide start-up programs (or services)
  2. Per-user / per-login programs

Crontab is not a part of either of the above (although, crond / equivalent service, is part of category 1) )

 

This distinction is important, since some stuff can not be run / will be redundant to run system-wide before a user has logged in. Linux (or most Unixes) is (are) a multi-user OS to begin with. If you put something that is supposed to be a user preference in system-wide startup files, it might 1) have no effect at all or 2) the setting might get overwritten by the desktop environment when the user logs in. Also, 3) it might annoy other users, if multiple users are using the computer and they do not like the same settings (if it works at all).

 

So, in your case you should set the startup commands to be run by your DE, when you (as a user) log in - i.e. /etc/rc.d is the wrong place (it might still work for you if you don't mind them set globally for every user - but might not, because the commands in question require X.org to by running when you run them, and your DE might overwrite them even if they complete succesfully in the background).

 

Where / how, depends on your desktop environment (KDE, Gnome etc.).

 

Crontab is sometimes a good tool, but not for this task. It is used to schedule recurring programs (not necessarily at startup); 'man 5 crontab' for more details. It is important to note that running 'sudo crontab -e' will edit the super users crontab; running it without 'sudo' will edit per-user crontab, which should be preferred. However, per-default, the user might not have permissions for their own crontab (this depends on the distro). Also "* * * * *" will cause the program to be run every minute. This will not hit the CPU and probably won't harm the system, but it is still a gludge and not a clean way to achieve this. Note from the man page: there is also the keyword "@reboot"; but this might not work, if the crond is run before the GUI.

Link to post
Share on other sites

On 2/10/2017 at 11:32 PM, Kilobytez95 said:

But will that allow me to run terminal command at startup?

yes you can put it in crontab wih @reboot at start. ubuntu will execute code after it after every startup. you could run script with your commands with sleep 100. this means it will run after 100 seconds and put & sign at the end of cron comand. this way you will know that your command will run after everything starts. i do not think any moder pc neefs so much time to just start.

Computer users fall into two groups:
those that do backups
those that have never had a hard drive fail.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×