Boot / etc/ rc.local What about invalidity? resolvent

Linux boot /etc/rc.local failure problem to provide three ways to solve the boot can not start the rc.local file problem, need friends refer to the following.

/etc/rc.local = /etc/rc.local

1, echo /etc/rc.local>

1, echo /etc/rc.local>; > /etc/profile & & Source /etc/profile



2, reboot

echo /etc/rc.local>
echo /etc/rc.local> > ~/.bash_profile & & The source/etc/profile
in the/etc/rc3. D increase a startup scripts directory, and then restart the test, the content is as follows:

cat /etc/rc3.d/

#! /bin/bash

# [email protected]

route add default gateway dev xenbr0

Some commands cannot be executed in /etc/rc.local
To add a service that automatically runs when the system is started, simply add it to the /etc/rc.local script file. When the command or program is running without a path, for example:


#! /bin/bash
Distccd –user nobody –allow –log-file=/var/log/distcc.log –verbose –daemon
loadavg-s>; /dev/null 2> & 1

Note that the distccd, loadavg commands are stored in /usr/local/bin/
When the system executes these commands, it will report an error and cannot execute properly!
Because the PATH environment variable was not fully initialized when the rc.local script was executed, the directory /usr/local/bin/ was added to the PATH environment variable only after /etc/profile was executed.

Executing commands in /usr/local/bin/directory in /etc/rc.local requires absolute path.

Read More: