I have some python commands that I want to run at startup, what I need to do everytime I boot my machine is manually start them by changing directories and executing them. Is it possible to make an exectable file which will execute a list of commands in the terminal? Or is it possible to let those command run at the startup ? It will be very handy to make those run by a simple double click instead of manually doing that.
2 Answers
First you need to make the file executable using cmd chmod +x filename.py as your say it is a python file.
After press start button or open Ubuntu dash and search StartUp

Click on Add

You will able to see as above now enter name of command and provide path of file, if you want can add some comment. now click on add, your program will run on startup
I suggest using rc.local to run your commands at the startup (boot time).
First
cdinto the commands directory:cd /path/to/commandsThen make them executable (
*.pymeans all files with thepyextension):chmod +x *.pyYou can run the command one by one on all files too:
chmod +x command1 command2 cmd3
Open
/etc/rc.localfile using an editor you like:sudo nano /etc/rc.localAddd the commands like:
./path/to/commands/command1 ./path/to/commands/command2 ...Save the file and make sure
rc.localitself is executable:test -x /etc/rc.local || sudo chmod +x /etc/rc.local
You are done, in each boot your commands get executed.
- 57,256