I want that when I start Ubuntu 16.04, I automatically run a script, so far I have the following:
script.sh:
#!/bin/bash
mkdir prueba_carpeta
and what I have done to run automatically is as follows:
-
I give you permission.
sudo chmod +x script.sh
-
I add it in the rc.local
sudo nano /etc/rc.local
rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh /var/www/html/script.sh
exit 0
But it does not work, I also tried:
sudo mv /var/www/html/script.sh /etc/init.d/
sudo chmod +x /etc/init.d/script.sh
sudo update-rc.d script.sh defaults
But it did not work either, I clarify that after performing each form, I restart the S.O. , I also clarify that when I run the script in the console, it works.