Is everything with +x in /etc/rc.d run at boot time?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
No /etc/rc.d does have SOME things that are run at boot but others depend on run level:
ls -l /etc/rc.d
total 112
drwxr-xr-x 2 root root 4096 Mar 14 12:38 init.d
-rwxr-xr-x 1 root root 2255 Nov 13 2008 rc
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc0.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc1.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc2.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc3.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc4.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc5.d
drwxr-xr-x 2 root root 4096 Mar 14 12:39 rc6.d
-rwxr-xr-x 1 root root 220 Nov 13 2008 rc.local
-rwxr-xr-x 1 root root 27420 Mar 5 2009 rc.sysinit
init.d is a directory of init (boot) scripts but they aren't run from that directory directly.
The rc?.d directories are run level specific directories. The init scripts are linked into these directories and stopped/started when going into the specific run level. So if you went from Run level 2 to Run level 1 (single user) then the rc1.d links would get executed. If you booted your server and your default run level is 5 then it would start the links in /etc/rc5.d.
You can determine your current run level by typing "who -r". You can see what your default run level is by typing "grep initdefault /etc/fstab" which should show something like:
# 0 - halt (Do NOT set initdefault to this)
# 6 - reboot (Do NOT set initdefault to this)
id:5:initdefault:
The last line shows you default run level is 5. It might be different on your system. (5 is typically used for systems on which X windows is started automatically.)
I may have been getting confused by lines like this from /etc/rc.d/rc.M
(Meaning if I make an /etc/rc.d/rc.* file not executable, then it wouldnt start)
# Start the MySQL database:
if [ -x /etc/rc.d/rc.mysqld ]; then
. /etc/rc.d/rc.mysqld start
fi
# Start Web server:
if [ -x /etc/rc.d/rc.httpd ]; then
. /etc/rc.d/rc.httpd start
fi
In addition to the fact that it wouldn't start, it may not even be in /etc/rc.d/{rc.M,rc.S} or /etc/inetd.conf.
I do recommend commenting them out (I've heard it improves boot up time). That way instead of checking to see if the rc.* is executable, and then attempting to execute a non-executable file, commenting out the part of the respective script that starts the rc.* file will just skip that part entirely.
instead of removing the executable bit of a script, comment it out in your rc.M file if you don't need the script to run at all,
this way you don't have to change the executable bit. then when the time comes you need the script to run, we can do
# /etc/rc.d/rc.<scriptname> start
without adding the executable bit again everytime you want to run the script
instead of removing the executable bit of a script, comment it out in your rc.M file if you don't need the script to run at all,
this way you don't have to change the executable bit. then when the time comes you need the script to run, we can do
# /etc/rc.d/rc.<scriptname> start
without adding the executable bit again everytime you want to run the script
You do not need to make the script executable to run it if you invoke it like
# sh /etc/rc.d/rc.<scriptname> start
The disadvantage of the "commenting out" approach is that system maintenance with regard to updates and upgrades requires additional diligence. I would be interested to see if there is really a noticeable difference in speed. Unlike what TommyC7 wrote, if the executable bit is not set then it does not try to run the file.
You can see what your default run level is by typing "grep initdefault /etc/fstab" which should show something like:
# 0 - halt (Do NOT set initdefault to this)
# 6 - reboot (Do NOT set initdefault to this)
id:5:initdefault:
The last line shows you default run level is 5.
I think perhaps that you meant "/etc/inittab" rather than "/etc/fstab".
Code:
grep initdefault /etc/inittab
In any case, thanks for mentioning "who -r". I was not aware of that command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.