Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
63
rated 0 times [  63] [ 0]  / answers: 1 / hits: 260544  / 2 Years ago, thu, february 24, 2022, 4:00:00

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically during boot?


More From » boot

 Answers
1

Place the script you want to run in the /etc/init.d directory and make the script executable.



chmod 755 myscript


Once that is done create a symbolic link in the run level directory you would like to use, for example if you wanted to run a program in the graphical runlevel 2, the default runlevel for Ubuntu, you would place it in the /etc/rc2.d directory. You just cannot place it the directory, you must signify when it will run by indicating the startup with an “S” and the execution order is important. Place it after everything else that is in the directory by giving it a higher number.



If the last script to be run is rc.local and it is named S99rc.local then you need to add your script as S99myscript.



ln -s /etc/init.d/myscript /etc/rc3.d/S99myscript


Each backward compatible /etc/rc*.d directory has symbolic links to the /etc/init.d/ directory.


[#31410] Saturday, February 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leadprogres

Total Points: 298
Total Questions: 114
Total Answers: 139

Location: Samoa
Member since Mon, Nov 8, 2021
3 Years ago
;