🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
How to execute script file at startup without using any commands like ln -s or any other to be executed at first?
October 23, 2016
September 20, 2023
Copy to clipboard: false
/assets/js/search.js will update text..
Interesting question. Thanks for pointing out files in
/etc/rc0.d you learn something new every day!
Create directory to drop your scripts into
First you need to create a directory of scripts you want automatically run at startup. I would suggest creating it within
/usr/local/bin but it can be anywhere:
sudo mkdir /usr/local/bin/startup-scripts
Modify rc.local to run all your scripts
gksu gedit /etc/rc.local to edit the startup script that has
Before the last line that says
exit 0 copy and paste these lines:
for SCRIPT in /usr/local/bin/startup-scripts/* do sudo chmod +x $SCRIPT ``` $SCRIPT ``` done
Optionally, for every script in the
startup-scripts directory, I would put in something like:
echo "running script xyz within /usr/local/bin/startup-scripts"
as this message will appear in
/var/log/syslog file and document your system setup.