15

Is ubuntu's /etc/init.d directory exactly equivalent (functionally) to what I presume to be the more standard /etc/rc.d/ (at least on arch)? Is there any particular reason canonical used init.d instead of rc.d for startup scripts?

  • 1
    actually arch linux is the only distro that uses /etc/rc.d that I've seen... I suspect it might be used in bsd. – xenoterracide Oct 26 '10 at 22:24
  • 1
    it is used in freebsd – wlraider70 Feb 4 '15 at 0:09
16

Ubuntu uses /etc/init.d to store SysVinit scripts because Ubuntu is based on Debian and that's what Debian uses. Red Hat uses /etc/rc.d/init.d. I forget what Slackware uses. There just isn't a standard location.

Ubuntu is in the process of switching from SysVinit to Upstart, which uses configuration files in /etc/init.

  • 2
    Sorry, but /etc/init.d is the standard, as part of the SVR4 standard that Linux start scripts copied. – Rich Homolka Oct 26 '10 at 23:17
  • Upstart's website claims Ubuntu has been using it since version 6.10 – badp Jan 16 '11 at 13:05
  • @badp: Though 6.10, still used SysV-style init scripts in /etc/init.d. The transition to /etc/init/*.conf started later (8.04 was still all SysV-style, 10.04 was already transitioning). – Gilles Jan 16 '11 at 13:33
  • 2
    Ubuntu switched from Upstart to systemd since 15.04. – PetroCliff Jul 21 '16 at 21:53
7

/etc/init.d was the old historical location for SVR4. I forgot why redhat added the /etc/rc.d/ level. I think to isolate things onto rc.d, but then needed to add a bunch of symlinks anyway for backwards compatibility. So there is /etc/init.d in redhat, just it symlinks elsewhere.

So the standard location is /etc/init.d, though it may be a symlink not a real directory.

There were some really old Linux distros that copied BSD with /etc/rc.local but pretty much no one uses that anymore.

6

Slackware still uses /etc/rc.d

FreeBSD uses /etc/rc.d and /usr/local/etc/rc.d

5

Historically, the /etc/rc.d directory tree denotes an Init system which follows the 4.4 BSD tradition of system initialization, which is usually called the rc init system. All the modern (Free/Open/Net)BSD system and Slackware Linux follow this tradition.

The /etc/init.d directory tree denotes the System V (SysV) init system which follows the AT&T UNIX, SunOS, Solaris tradition of system initialization. This is commonly called the SysV Init system. Debian proper still follows this tradition in the Wheezy series, but plans to use SystemD in the Jessie series. Historically, RedHat and derivatives have used SysV Init, but don't anymore.

Also, over time, features of both init schemes have been adopted by distributions.

  • And then there is AIX with "/etc/rc.d/init.d/". A little bit of column A and a little bit of column B. – DarkHeart Sep 14 '16 at 23:14
0

Actually, at least in CentOS 6.8 Santiago, /etc/init.d is just a softlink to /etc/rc.d.

  • That's exactly what I meant, haha. Sorry about the wrong spelling, I edited my reply now. – chromechris Sep 14 '16 at 22:19
  • Why do people downvote without giving an explanation? The statement unless intentionally irrelevant can still have value or meaning to some novice reader. Explain when you downvote. I +1 to undo the effect of -1 – Asad Iqbal Jul 14 '17 at 13:26
0

PuppyLinux has both /etc/rc.d and /etc/init.d, neither being a symlink. What is a symlink is /etc/rc.d/init.d, which links up a level to /etc/init.d (I'm looking at a Slackware-based Puppy-- there are also Ubuntu-based and other flavors.) There's a README.txt in each, explaining their approach.

0

Ok so, /etc/init.d is a place where you can quickly deploy an init script. The second step towards activating this script is to run a chkconfig command on it. Say you run chkconfig --add <yourscript>, symbolic links will be created between /etc/init.d/<yourscript> and /etc/rc.d/rcX.d/S50<script> for example. X in rcX.d representing the runlevel number of the script, and S50 representing the script type (there are two of these types, S & K, S tells the system to start the script when it boots up, and K tells the system to exit the script gracefully when you shut down. The number after S/K represents the order at which these happen, in case you have some scripts that depend on others being active first). By default, if no runlevel is specified inside the script or when you issue the runlevel command, CentOS6 creates S50 scripts for runlevels 2,3,4,5 and K50 for runlevels 0,1,6 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.