Slashdot Mirror


Which Style Init Scripts Do You Prefer?

An anonymous reader asks: "I started using Linux years ago, with a Red Hat distribution. When Red Hat's custom configurations started getting in my way, I jumped ship to Slackware. I have never looked back except that I cannot stand the BSD style init scripts. I like having a full compliment of run-levels and control on the fly over which scripts will be running, and which ones will not. That is hard to achieve, when you put multiple configurations in the same file. I also liked having the scripts around to start, stop, and restart services. While I was rewriting my own startup scripts [based on Debian's scripts], I discovered that there is a third style, based on dependencies. AFAIK this is the style adopted by Gentoo. I don't want to start a distro war; but, I am curious about what kind of init scripts Slashdot readers prefer, and what they think are the benefits of each."

35 of 123 comments (clear)

  1. FreeBSD 5's RCng by cbiffle · · Score: 5, Interesting

    You might want to take a gander at FreeBSD 5's RCng (also available in NetBSD, and possibly OpenBSD).

    It combines, in my opinion, the best of both worlds:
    1. Full control over each service through scripts in /etc/rc.d. Want to restart your sshd? /etc/rc.d/sshd restart. Very similar to init.d.
    2. Dependency-graphs determine service start order. Each file contains a special header declaring its dependencies and what it provides; the system analyzes these on boot, or when you request that a specific service be started, and handles the dependencies for you.

    Mmm, tasty.

    (And yes, this is quite similar to Gentoo's system, except that Gentoo translates the scripts into actual runlevels behind the scenes, whereas the BSDs do not. That, and this doesn't use python.)

    1. Re:FreeBSD 5's RCng by Brandybuck · · Score: 2, Insightful

      I love the new rcNG! All of the benefits of SysV without any of the stupidity. Install CUPS and get this cups.sh script. Just drop into /etc/rc.d and you're done! Actually, freeBSD drops cups.sh into /usr/local/etc/rc.d, which is even better. No need to symlink it to death.

      But the "old" way wasn't that archaic. Most people arguing on the SysV side seem to think that BSD init scripts got petrified into a single massive script back in 4.3BSD. Hardly!

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:FreeBSD 5's RCng by Otter · · Score: 3, Insightful
      (And yes, this is quite similar to Gentoo's system, except that Gentoo translates the scripts into actual runlevels behind the scenes, whereas the BSDs do not. That, and this doesn't use python.)

      I'm a Gentoo fan, not because of the (mostly imaginary) performance advantages, but because to my taste, it's the easiest Linux to maintain once it's up and running. That's largely from portage, but it's also the only Linux on which I've found the init system to not be an enormous pain in the butt.

      The SysV system may well have advantages for knowledgeable admins -- but as a user who just wants ntp to run properly, Gentoo has been a blessing. (Also, I don't believe the Gentoo system uses Python. The parent may be thinking of portage, or I may just be wrong.)

    3. Re:FreeBSD 5's RCng by Brandybuck · · Score: 2, Informative

      /usr/local is for everything that doesn't belong to the base OS. Additional packages, in other words. It's following the FHS standard. Why should it drop third party configuration files into /etc?

      --
      Don't blame me, I didn't vote for either of them!
    4. Re:FreeBSD 5's RCng by merdark · · Score: 2, Insightful

      Well, there is http://www.linuxbase.org. And as for apt putting things in /usr, this goes back to what you call my *troll* about old software. It might be a troll if it weren't true. And yes, you can get 3rd party .deb packages with *some* newer software, and if you install these, they all go in /usr and can cause conflicts with stuff that *is* in the base system. I've had first hand experience with this.

      But whatever, I guess we can agree that the BSD layout *isn't* confusing after all. Neither is debians of course. There is no point in arguing which layout is better since I'm sure we are both very much happy with our respective fav. systems.

      Have fun using Debian, and I'll stick with BSD where I have a choice.

  2. Re:Sounds like a lot of trouble by IMSoP · · Score: 2, Informative

    The choice is "important" in terms of minimising workload / maximising efficiency - the different approaches allow you to do different things more or less easily.

    This discussion is not particularly important, the poster was just "curious" - although people may well give useful information to each other as a direct result of its existence...

  3. Mac OS X by Tor · · Score: 3, Interesting

    Mac OS X does what I have long wanted to see in a UNIX system, parallell/dependent startup. For instance, "vtun" depends on "tunnel.kext" and "networking", but both "tunnel.kext" and "networking" can be started simultaneously. Also, the "StartupParameters.plist" meta-information file has some parameters related to order preference ("early", "late", and so on).

    An article describing a similar concept for Linux can be seen at IBM DeveloperWorks.

    Sounds like that may be what Gentoo does?

    1. Re:Mac OS X by Hes+Nikke · · Score: 2, Informative

      an interesting thing with the Mac OS X boot is that all this service starting isn't driven by the init scripts like linux and *BSD. Mac OS X has a 'service' started by the BSD rc scripts, called SystemStarter, that does all the parallel service starting. there are still some services that are started serially, (like NetInfo, after the Mach bootstrap based services, and portmap) however most services are started by SystemStarter.

      --
      Don't call me back. Give me a call back. Bye. So yeah. But bye our, well, but alright we are on a shirt this chill.
  4. My init scripts by Kethinov · · Score: 2, Interesting

    Init scripts concern my very little because I almost never reboot. For the record, I use Gentoo and they seem to work fine, but my Gentoo box is nearing a month of uptime. I only rebooted it because I recompiled the kernel. Maybe I should reboot now just to watch the init scripts for fun...

    --
    You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
    1. Re:My init scripts by stevey · · Score: 2, Informative

      This can sometimes be a problem - when I started my job there were a few machines which hadn't been rebooted in a year or two.

      During that time extra services like SSH, rsync, etc, had been installed and they'd been started manually.

      When it finally came to the time for the machines to be brought down and restarted then lots of services which had been running for the past few months would be mysteriously missing.

      Several times I tracked this down to missing init scripts - and shortly afterwards I made a plan of bringing down each of our machines at least once every six months to make sure that all the startups systems work correctly.

      Sure no more uptime pissing contents but I do know that if there is a power outage and the machines go down they will come back up (barring frying!)

  5. Two things I hate about gentoo and on topic. by SmallFurryCreature · · Score: 3, Insightful
    One is that on every emerge portage a number of configurations changes are made that are pointless. Like a change of the number of spaces in /etc/fstab. 1. who cares if there are two or three tabs between options? 2. /etc/fstab will always be different for the user anyway since the default one has nonsense values.

    Anyway on to the init. I do sorta like the init system except the use of the stop-start-daemon. Works fine if everything has well but is as a dumb piece of shit when it doesn't. Will happily insist that something is running when it isn't or that it isn't when it is. Have for some services now changed the scripts to stop using that crap anyway.

    Have asked this on the gentoo forum but noone so far has given me a reason let alone a good reason why the stop-start-daemon is used at all. Especially for stuff like apache where the gentoo initscript has less options then apachectl has.

    Anyway rebooting just to see the init scripts seems a bit, odd. Kinda like saying you like windows crashes because of the cool splash screen. Get a girl :)

    But if you ever do an emerge -u portage and then etc-update make sure you know what you are doing. A lot of the updates you can simply do EXCEPT for the files wich you may have changed. Problem is you may have forgotten and then you could really break something. I had it happen once when I accidently overwrote the net configuration. No a smart move on a remote machine. Noticed it only after hosting provided added hardware and then rebooted it as a very secure server (no netaccess).

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

    1. Re:Two things I hate about gentoo and on topic. by LittleBigLui · · Score: 2, Insightful
      But if you ever do an emerge -u portage and then etc-update make sure you know what you are doing. A lot of the updates you can simply do EXCEPT for the files wich you may have changed. Problem is you may have forgotten and then you could really break something. I had it happen once when I accidently overwrote the net configuration.


      Just look at the diffs - it's pretty obvious then that something is machine-specific. (even better, when changing something in /etc, just add a comment right above your changes stating you made them - good practice anyway)
      --
      Free as in mason.
  6. Grump by NanoGator · · Score: 2, Funny

    I think I'm going to upgrade to BOOT.ini.

    --
    "Derp de derp."
  7. Slackware's init by c.r.o.c.o · · Score: 4, Insightful

    You will pry the Slackware init scripts from my cold dead hands!

    On a more serious note, I had always run Slackware on my gateways (about 6 years total), so I know the scripts pretty much inside and out. I have a lot of very specialised scripts that I wrote from scratch tailored specifically for my gateway and home network. But on my workstation I tried a variety of distribuitons, and for a very long time I ran RedHat (from rh4.2 to rh7.3.), mainly because I enjoyed constantly upgrading rpms and trying out new things.

    I ran into the same problem you did around the time RedHad came out with rh8.0. I found it amost impossible to track every config file in /etc, because of RedHat's non-standard installation. Not to mention the mass of files in /etc and all over the hdd that I had NO ideea what their purpose was. At that point I realised that the advantage of rpms was far outweighed by the horrible system management in RedHat. Then I tried pretty much all distros out there, and I finally settled on Slackware for my workstation and laptop as well.

    I happen to like the BSD style scripts. They make maintainance a breeze, and they almost never need to be changed. Even when I reinstall Slack (for whatever reason, last time it was a hdd starting to fail), I find that most scripts and config files can just be copied over to the new distro. I actually had a masquarading script that lasted me from kernel 2.0.20 untill 2.4.x was released.

    So there you have it, I _love_ the Slack init scripts. I'm not sure there are much better ones out there in terms of simplicity and complete control. Sure, maybe RedHat's linuxconf (is that thing still around?) may make changing stuff and automation easier, but at a significant loss of control. And God forbit you fubar linuxconf's dependencies so you can't run it. Then you'll really appreciate Slackware.

    1. Re:Slackware's init by mnmn · · Score: 2, Insightful

      I cut MY teeth on slackware. We ordered 3 CDs from infomagic, a debian, a slackware and redhat and we split it among 3 friends. Slackware was the one I could install the fastest before even learning anything about Linux.

      I know its scripts inside out too, altho I just use joe and delete entire swaths of scripts I'll not need like quotas, RCS, dos ums etc. Usually I follow that with a new kernel compile to finish things up and have a real personal server.

      I know them really well, but I cant really say I 'like' them best because I have an affinity of knowing all major UNIXen as much as I can, and I've been getting myself exposed to FreeBSD, Solaris, RedHat and OpenBSD quite a bit. I do head straight for the scripts though and never use linuxconf or server start apache or the likes.

      I guess once you get really used to both BSD and SysV styles, it wont really matter. I have more personal preferences on window manager (twm), console type (one in which backspace/del/home/end all work), shell (bash2), init type (normal, not the damn xinit), firewall tool (openbsd pf), filesystem (xfs) and kernel compile method (BSD).

      Just get used to everything and be a Unix guru.

      --
      "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
    2. Re:Slackware's init by macdaddy · · Score: 2, Insightful
      I've been using RH for a long time now. Frankly if someone asked me to build them a rock solid mail server today I'd build it on a RH 7.3 installation. Granted it wouldn't much look like RH when I was done but that would be my foundation. I have RH 9 on my newest server and I can't stand it. Don't get me wrong, I love RH-style init scripts. I write and submit init scripts all the time for packages I use that don't already have them. It's easy and yet powerful. I don't really give a hoot about dependancies. I'm compotent enough to take care of that on my own.

      I am however looking to dump RH thanks to RH9. I skipped all the 8's do to horrible reviews and now I see that 9 isn't much better. I'm currently downloading Gentoo ISOs and I plan on getting it up and running soon. I don't however like the idea of having to learn yet another style of init scripts. I'm not looking forward to that at all.

      Frankly I like RH's approach to where it puts many things (note I didn't say all). I like ALL of my configuration files to be in /etc/package_name/. I like *almost all* of my binaries to be in /usr//{bin,sbin}. I use /usr/local for all packages I compile myself (which is just about every daemon and most important additional packages. I don't like how the BSDs install a package in /usr/local/package_name/{bin,sbin,lib,man,etc}/. That annoys the hell out of me.

      RH has good things going for it in my eyes. I do however absolutely HATE how RH put libraries to seemingly random places in RH9. Kerberos really gets my goat. I also hate how damned near everything is staticaly linked to specific libraries. That makes upgrading something like libz or libsasl a royal PITA. Damn RH to hell for that one.

      I also despise the incompotence of RPM. Just because I didn't install RH's libgd doesn't mean I didn't compile a much newer version by hand. RPM is too damned stupid to be able to check for such a thing. I really hate RPM.

      Basically I like a lot of how RH does SOME things. I hate a lot of what they're doing nowadays too. If I could find a distro similar to RH that does things right, I'd be very happy.

    3. Re:Slackware's init by vic_ferrari · · Score: 2, Informative

      Stripped to the bare bones, a minimal RH7.3 installation is 350MB, and you don't even need everything you get. If you choose the "server" class installation, you need 1.3GB just to install. If you claim "it wouldn't look much like RH when (you were) done," why would you start with that much baggage in the first place? I like OBSD for mail servers (among others). You don't have to recompile all the packages just to get them to work the way you need, and it includes what you need to run a server -- mail server, apache, etc. The default installation is lean and sleek at 225MB, and you can do bare bones under 100MB. There are plenty of Linux distributions out there designed with the same idea. Why not use one of those and leave RH to tend their market? If you want to roll your own, why use RH in the first place? BTW, you have static and dynamic linking confused. Static linking builds libs into binaries. Dynamic linking trims executable sizes and uses shared libraries on disk (think DLLs), and is what's giving you problems when you upgrade only parts of your system. Sounds like you have a good start learning Linux, and with a little more experience, you'll be building real servers soon. Best of luck to you.

  8. Slack's scripts are fine... by damien_kane · · Score: 3, Informative

    You want ssh? /etc/rc.d/sshd start
    Apache? /etc/rc.d/rc.httpd start
    Samba? /etc/rc.d/rc.samba start
    Same goes for nfsd, inetd, gpm, cups, bind, acpid, etc...
    rc.6 for restart, rc.0 is statically linked to it to make sure they're always the same.
    rc.S is called on runlevel 1 by default, as rc.M is called for 3.

    On top of that, if you like your System 5 scripts, call rc.sysvinit.

    Where exactly is the problem?

    1. Re:Slack's scripts are fine... by chad_r · · Score: 2, Interesting

      You want ssh? /etc/rc.d/sshd start
      Apache? /etc/rc.d/rc.httpd start
      Samba? /etc/rc.d/rc.samba start
      Same goes for nfsd, inetd, gpm, cups, bind, acpid, etc...
      rc.6 for restart, rc.0 is statically linked to it to make sure they're always the same.
      rc.S is called on runlevel 1 by default, as rc.M is called for 3.

      True. And IIRC many of these are either new standard packages or were removed from rc.inet[12] starting with Slackware 9.0 (so the original question is somewhat moot). However, there are still some services still buried with rc.inet[12]. If you never change services except by rebooting or changing runlevel, it doesn't make much difference. But say you need to restart DHCP after a reconfig, for example. Here are one set of steps to do it:

      • First, try kill -HUP $(pidof dhcpcd) and pray it uses that signal to reread its configuration. Otherwise, a manual kill/start is needed (see next steps).
      • kill $(pidof dhcpcd) possibly with a ps first if you weren't feeling lucky)
      • Try to remember the correct syntax for restarting the daemon. Look it up in the rc scripts, just to be sure
      • Hmm, which rc file is it in? grep -l dhcpcd /etc/rc.d/rc.*
      • Aha, it's in rc.inet1 less /etc/rc.d/rc.inet1
      • It looks like /sbin/dhcpcd -t 10 ${DHCP_HOSTNAME} -d eth0 is the syntax. Time to scroll up and find what the value for DHCP_HOSTNAME is
      • Nope, DHCP_HOSTNAME isn't defined. Issue /sbin/dhcpcd -t 10 -d eth0

      Maybe there's a better approach to doing quick restarts than the way I have suggested above. But personally, I find it much easier to have a /etc/rc.d/rc.service restart command do it in one shot. BTW, I also like the Solaris approach of hard links from rc*.d to init.d. It means I can do all my runlevel changes with filesystem commands, and never need to edit a file (and possibly introduce a syntax error) once it's created. But that method just gives people fits, so I won't go into it.

  9. BSD-style by ctr2sprt · · Score: 5, Insightful
    The thing I like most about BSD-style scripts is that they don't insist on starting and killing daemons one at a time. They also allow for asymmetric scripts, sort of; Linux tends to kill every service individually on shutdown, which is really annoying because it takes forever. 99.9% of programs can handle kill -TERM -1 && sleep 5 && kill -KILL -1, which init does automatically when it changes runlevels. I guess it's nothing inherent in SysV-style scripts I dislike; it's the way they're used.

    I don't think the lack of "/etc/init.d/daemon stop" is that big a disadvantage. "killall daemon" works just as well - in fact, that's all most stop scripts do. The only thing you lose is the pretty color graphics.

    This is definitely prime material for a religious war, though, as neither approach offers any real benefit. You can easily make either approach do whatever you want. With SysV-style scripts, it's slightly easier to let packages say how they should be started; with BSD-style scripts, it's slightly easier to understand the "big picture."

  10. Gentoo's bootscripts do not use Python. by Safrax · · Score: 2, Informative

    If you had bothered to actually look at Gentoo's bootscripts, you would have noticed there is no python. It is all bash based.

  11. the BSD style changed by JDizzy · · Score: 5, Informative

    The notion of a run-level is a flaw that is fatal, and will lock you in. However, the BSD's never did lock themselves into this notion, and in fact doesn't support init levels except for compatibility. NetBSD doesn't support init 6 for instance, but freebsd does. I think OpenBSD, and Slackware are the only distro's left that use the old BSD way, as NetBSD and FreeBSD now use rcNG (next generation) in their startup. The think is that system startup is linier in nature (aka in line, and in order). The sysV style startup is based on the shell's lexical ordering, which is nice, but is way too simple. You cannot have complex dependancies like scriptA depends on scriptFOO, and scriptFOO might depend on scriptB. Lexical ordering is easy, but too simple. For example the timed might depend on the network to be started before it can contact the stratum servers. So the new BSD startup scripts has a notion of ordering that isn't dependant on lexical alphabet soup. Your script PROVIDES a service, and might REQUIRE another service before it starts, and might need to run BEFORE another service. These keywords can be placed in commenst of yoru startup scripts to control the startup ordering of the services via the program called rcorder, which parses all the startup scripts, and then executes them in order. This the best way to startup because it doesn't depend on a flawed notion of run-levels which plauge the unix history. the only problem is that they do not provide a way to starup sevices in tandem, or to execute an forget orphan services which neither REQUIRE another service to startup, or need to be run before anything else. It would be possible to speed up startup execution if you could have job-control in the startup scripts. Luck for us the shell can do this, but nobody seems to use it. The problem with having complex dependancies is that you remove the simplicity of lexical orderign which seems so intuative. Now you have to edit the scripts to achive the ordering you want, which is cumbersom, and only for a few seconds increase in overall startup speed. And to think that all this is as simply as /sbin/init executing one user land process (a shell script). Certainly when you think of it this way it is simple, but nobody wants to write startup scripts, which is basicly redesigning the wheel.

    --
    It isn't a lie if you belive it.
  12. First impression by bofkentucky · · Score: 3, Informative

    The company I work for end up with a motley crew of turbolinux machines that had daemontools put on them, I did not like it, but some people swear by being able to do a svc -u /service/apache instead of a /etc/init.d/apache start, I guess it comes down to what you are comfortable with, but I've gotten used to /etc/rc.X/S* start|stop|restart from solaris, just pick one and stay with it.

    --
    09f911029d74e35bd84156c5635688c0
  13. Maybe yet another style... by kosmosik · · Score: 2, Informative

    IBM Dev Pages had an interesting view on this. Althougt it is more for desktop setups (system boots faster - who needs that?). But still it is IMO interesting: Boot Linux Faster.

  14. MS-DOS autoexec.bat, baby! by pla · · Score: 2, Insightful

    Though partially a joke, I mean that as a not entirely unserious preference.

    When I started learning to use Linux, I found the layout of init scripts as one of the single most confusing "features". Once the system makes it up, everything seems so simple as to make you cry when you need to admin a Windows box. You invoke a program, it has a corresponding process, you can kill that process if you want to. Even "special" programs, such as daemons, work that way. Only kernel modules really differ, and even they have a conceptually similar interface - You can insmod, lsmod, and rmmod to start, check, and kill them (if applicable).

    But then we come to init scripts... Oy. What runs when? What order? With what permissions? Does script X really run, or just take up space in the rc.d directory? Yeah, I know how to answer all of those questions, and know the default answers for a few different styles, but I don't see the need to have them as questions at all. In many ways, a nice monolithic autoexec.bat-style boot script would, for the vast majority of installations, more than suffice.

    On my own systems, I usually go through and remove 99% of the init crap. I want to fsck my disks and then mount them, actvate swap if needed, start dhcpd or set up a static interface, load sshd and perhaps a handful of other daemons depending on the purpose of the machine, and perhaps clean up /tmp and /var. And nothing more. I can do all that in about 15 lines, why do I need that scattered over half as many files?

    On more than one system I control, I have inittab do nothing but rc.local, end of configuration. It works just fine, and anyone capable of using an up-and-running Linux box can tweak its bootup activity just as easily.

  15. Don't care, don't reboot enough... by rthille · · Score: 2, Informative

    However, I do like using 'svscan' (DJB) behind the init scripts. Shutdown/restart/etc is simple and logging is handled well.

    --
    Awesome furniture, accessories and cabinetry in Santa Rosa, CA: http://humanity-home.com/
  16. Runit: the ONLY sane solution by OdinHuntr · · Score: 2, Informative
    runit operates like DJB's daemontools but is tailored to run as process 0 in a unix system. Its operation consists of three scripts: one which starts the system, one which is alive for the duration of the system's uptime, and a third which handles shutdown.

    The second script runs something analagous to daemontools's svscan and runs svdirs, which are obviously superior to init scripts because you do not replicate any code. All of the start/stop/etc handling is done by the process that controls the daemon.

    The most obvious benefits are that .pid files are obsolete as it's obvious which process is being run by the system (as it is a child of a runsv process that monitors it) and that services can be started in parallel with dependency handling. Additionally, runit will automatically restart processes that die/crash and handle logging their stderr to rotated logfiles via multilog.

    Debian users can apt-get install runit runit-run and experience this themselves. I have run runit as process 0 on my laptop and desktop machines for months and use it on servers to monitor daemon processes, it has worked without a hitch. I highly recommend it (and wish that Debian would provide more runit svdirs for daemon processes :))

  17. init scripts are ESPECIALLY important by T-Ranger · · Score: 3, Insightful
    It forces you to save your configuration. And being forced to save your configuration might get you to think about it in an orderd and structured way before you do so. If you reboot every other day then you will catch (or resolve) these problems when they are still fresh in your mind.

    If you regularly have long uptimes you will fall into the trap of just doing things from the command line, but never 'saving' that anywhere. If you dont force yourself to use init scripts, then more often then never you will simply run an obscure - but very important command - and it wont be carried out on the next reboot. If you typed it in a week ago you might remember it, and remember the man page (and possibly even have it in your shells history file). If you typed it in 6mo ago you might have compleatly forgeten it. You might waste 5 minutes relearning it, but you might waste 5 hours too.

    A varriation on "laziness is a virtue".

  18. Flaw in SysV Init Scripts by edward.virtually@pob · · Score: 3, Interesting

    As other(s) have noted, this article is flamebait. My personal preference is BSD style. Beyond that, the only serious problem I've encountered with the SysV style is what happens if the "stop" case in a given script is flawed -- if it fails to exit, as in the case of trying to stop a program that is wedged due to failed hardware (i.e.: why you're trying to shutdown in the first place), the shutdown will hang at that point and you will be forced to reboot via the reset or power switches. This can result in serious data loss and is a failure in the SysV init design. This issue may have been addressed by now. Ideally, init should timeout if a given script takes "too long" and move on to the next one. Of course, this brings up the question of how long is too long and where you would set this, etc. Anyway, you asked.

  19. lukem of netbsd invented it by honold · · Score: 2, Interesting

    and here's a good overview of it with more technical links. it is my favorite setup by far, and i'm very glad to see fbsd5 and gentoo adopting its style.

  20. sysV or BSD? Who knows. As long as it works. by (0d0 · · Score: 2, Interesting

    IIRC, sysV has all these /etc/rc.?/ directories (corresponding to run levels) with a whole lot of S??foo and K??bar symlinks going back to /etc/rc.d/foo and /etc/rc.d/bar. I remember thinking, hey that's kind of a neat way to do things. That was when I was learning UNIX (Digital/Compaq Tru*64).

    When I picked up Linux (RedHat 6.0), I felt like I knew what I was looking at because it was similar. After that, I stalled with the RedHat upgrade cycle at 7.3 because it worked and worked well.

    Finally I had to upgrade my workstattion because chasing RPM dependencies got to be too much fun. (Yes, I know about apt, but then you have to hope that apt has what you want; if not, then the chase is on.) That's when I went looking for a new distro. Gentoo actually turned out to be my choice because it had "this thing called portage" which seemed very similar this other thing one of my former co-workers had been raving about with some BSD (free, I think; never tried any flavor of BSD) call "ports". Anyway, Gentoo sounded interesting and I gave it a try. After getting it installed and booted and configured, I started to try to figure out how it worked.

    First major difference was startup scripts. /etc/rc.d didn't exist. Neither did the /etc/rc.?/ directories. I was befudled. Then I figured out everything was in /etc/init.d. The concept of run-levels (I can tell why they are usefull; if you don't know, you've never done any real server work) was reduced to "boot" and "default". Everything that was needed for the essential running of the system was put into the "boot" runlevel. Everything else was in the "default" runlevel. Then, I started looking at the scripts in /etc/init.d. They aren't the regular #!/bin/sh scripts I expected. They were essentially "set some variables, define the functions start(), stop(), restart()." Among other things, they can define what they REQUIRE and PROVIDE and what they must start BEFORE and AFTER.

    Now from this thread, I think this is very BSD-like. I know it isn't the sysV style I grew up with. I think it's better because it is too easy to not add a link in a runlevel directory to start/stop a daemon when you need to. That is, if you put a S99foo in /etc/rc.3, but boot to runlevel 5, did you start foo? And if you have K00foo in /etc/rc.3 and go from runlevel 5 to runlevel 3, do you start or stop foo? I don't know.

    Now as to the questions of why use runlevel: if you have a *Real* server (big cabinet-style as seen in machine rooms at universities), you will find yourself at times needing to be at single-user mode for doing hardware checks/system maintenance. Other times, you need to allow more than one person on the machine, but don't want to have full services up: multi-user mode; let multiple parties perform their maintenance steps in parellel, but don't open the system up to everyone. Then, you can bring the system up to a level that allows a small set of users to log in and test prior to bringing the system up to full-service level. Sure, you can manually stop/start daemons as you move from one level to the next, but wouldn't it be neat if all you had to do was tell the machine "bring up the net work services" and it "knew" what to start? Oh, that's what a runlevel is for!

  21. flamebait by epine · · Score: 2, Insightful


    Now I know why init scripts are one of the major dark areas remaining in my understanding of BSD and Linux: the entire subject area is flamebait.

    I think there's a conceptual problem here. Whether a topic is flamebait or not does not stem from the topic, but the audience for the topic.

    If my wife asks me "why are you angry?" and I respond "that's flamebait" does that reflect badly on me or my wife?

    Probably more to the point, the reason this topic is flamebait is that init scripts are one of the great embarrassments of the BSD/Linux universe. It strikes me that the most passionate arguments occur around the most embarrassing features. In order to hide our embarrassment, we profess love.

    Personally, I haven't seen an init script yet that if made human wouldn't show up at a Trek convention dressed as Wesley Crusher.

  22. SSS - the fast init script engine by vojtech · · Score: 2, Interesting
    Well, for init scripts, I'm using the 'sss' program for quite a while:

    ftp://atrey.karlin.mff.cuni.cz/pub/local/mj/linux/ sss-0.0.1.tar.gz

    It's easily configurable, as everything is kept in a single, hierarchicaly structured config file.

    It's very convenient to use, since you can bring up whole subtrees of services up and down with a single command.

    And it's damn FAST, allowing to boot my system under three seconds from LILO to running WindowMaker desktop. It achieves that by reading just the single config time just one time and then piping all the commands that it needs to execute to bring the system up to a single bash instance.

    I used it once, and I can't never go back and replace the init scripts on every distro I use with it.

    How long do your init scripts take to boot?

  23. Closed source stuff expecting Sys V init by Xpilot · · Score: 2, Informative

    Like VMWare, it just *expects* Sys V init, so installing it in Slackware is kinda painful for a newbie.

    --
    "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it." -- Linus Torvalds
  24. Re:sysV or BSD? Who knows. As long as it works. by FreeForm+Response · · Score: 2, Insightful

    Gentoo supports arbitrary runlevels.

    For example, on my laptop I have boot, default, net, and X. Boot and default are the ones that come with Gentoo's base installation, and they have things like filesystem check, loading modules, hotplug, etc. Net loads PCMCIA modules and the driver for the wireless card, and I start it only if I actually have the card plugged in. X loads the sound drivers, video card modules, and xdm.

    Setup: make a directory with the runlevel name in /etc/runlevels. Use "rc-update add <service> <new runlevel>".

    Use: "rc <new runlevel>".

    I'm not an old hand at this UNIX/BSD stuff like most people here seem to be, but I can't think of anything else I'd like from an init system.

    P.S.- Gentoo supports parallel startup, too. It's a flag in /etc/conf.d/rc.