Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Startup Auto-Execution Bash Script

Writer Matthew Martinez

First post here. Please be gentle

There's a way to execute a bash command during the startup of Linux operating system? I could always put the script in /usr/local/bin open the terminal and recall it, but is a little bit annoying.

EDIT1 as suggested by steeldriver: The script has to enter in a root folder and change 2 values of charge thresold contained in a text file. For each start-up I'd like to be sure that the battery level wouldn't go over the 80%.

So in order to do that the script would execute a:

  • cd command
  • sed -i 's/0 100/0 80/g'

all of this, I think, has to be in sudo mode

EDIT2: as asked by K7AAY user:

Ubuntu Desktop 18.04 LTS version, I'm not using any virtualization.


Thanks for the answers

3

1 Answer

You could use crontab -e

@reboot /usr/local/bin/yourscript

You could also copy your *.desktop applications into ~/.config/autostart/ or scripts into ~/.config/autostart-scripts/ directory. But, instead of copying, use ln -s pathtoscript ~/.config/autostart-scripts/

You could also use the next GUI for it if you use KDE Plasma:

enter image description here

Or, for Unity:

enter image description here

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy