In this example I had a need to record boot up times in a file that i could access easily. To do so I decided to run a command on startup. This tutorial tool place on CentOS but the commands should also work on Ubuntu.
Edit the rc.local file in vi by running:
sudo vi /etc/rc.local
Add the following line to the file, update the home directory to represent your home directory.
- Press i to go into insert mode
- Enter the line:
- echo “the computer booted up at” `date` >> /home/darren/bootup.log
- Press ESC and then wq! and enter to save and quit the file.
Give the executable permission to the rc.local file by running the following command:
chmod +x /etc/rc.d/rc.local
Reboot the system by running:
sudo init 6
When the machine reboots run the following command to insure the file has been created and that there is content in the file:
A full video tutorial can be found here: