Free Hosting Online for WorkStations

< Previous | Contents | Next >

10.3.1. Running a System Command Automatically at Start-Up‌

At times, you may wish to add a custom command for the start-up process so that your computer executes this command every time it boots up.


Procedure 10.3. To run a system command automatically at start-up:


1. On the Terminal, type the following command to open the rc.local file:


$ sudo nano

­/etc/rc.local



Figure 10.20. Terminal Window


The rc.local file contains a script that is executed after all the other initial scripts. You can insert your own initialisation scripts in this file if you want some services to be executed automatically during the start- up process.


2. The rc.local file opens in the Terminal window. Type the command that you want to run at system start- up before the line, exit 0.


$ date >


­/home/oem/newbackup



Figure 10.21. Making Settings for rc.local File


3. After you enter the command you want executed at system start-up, press CTRL+X to save and exit the edited file.



Figure 10.22. Services Window


4. When you reboot the system, the rc.local file executes. If you want to display the output of the above command, type the following command in the Terminal:

$ cat newbackup


The following image shows the output of the above command:


Top OS Cloud Computing at OnWorks: