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."

123 comments

  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 ignorant_newbie · · Score: 1

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

      Actually, this is a netbsd invention. It's also implemented in Gentoo, albeit as a hack on top of the standard init.

      works pretty good, imho.

    2. Re:FreeBSD 5's RCng by Sepper · · Score: 1

      You know, i imagined the first post would be more like:

      'Yeah! another Distro War... (insert name of distro) rules! I 0\/\/|/| y0u |-|4x0R'

      as for witch init script you use... who care! as long as you know waht you are doing or there is good documentation (or a bit or both)

      it's kind of a tradeoff: usability or power... usability comes with limits on what you can change ...fine grain power comes with having full access, but having to do everything...

      Ok, so i did drink a little tonight and i AM a bit drunk, but i'm still making sense.... am I?

      --
      I live in Soviet Canuckistan you insensitive clod!
    3. 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!
    4. 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.)

    5. Re:FreeBSD 5's RCng by irc.goatse.cx+troll · · Score: 1, Insightful

      "freeBSD drops cups.sh into /usr/local/etc/rc.d, which is even better. No need to symlink it to death."

      Better? Thats one of the things I hated most about freebsd -- /usr/local/ was used for EVERYTHING, hunting down where anything gets installed became a huge task even worse than redhats /opt/. You had to babysit every install just to clean stuff up. Thank God for Debian-- Even sorts the docs for you.

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
    6. 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!
    7. Re:FreeBSD 5's RCng by merdark · · Score: 1

      /usr/local/ was used for EVERYTHING, hunting down where anything gets installed became a huge task even worse than redhats /opt/.

      So first you say that /usr/local is used for EVERYTHING, then complain you don't know where ANYTHING is? Well, hmm, maybe it's in... /usr/local? Nah. Too simple. Docs? How about /usr/local/share/docs (or something similar).

      BSD layout is simple, /usr/ for SYSTEM stuff, ie anything not in ports, /usr/local/ for everything else. And I use Debian at work (not by choice, I like software that isn't 3 years old). No easier to use in my opinion.

      And babysit installs?? What on earth do you do to your installs? Really! I've never done anything to my installs other than modify some config files. Nice troll.

    8. Re:FreeBSD 5's RCng by Directrix1 · · Score: 1

      A hack? Like its really a complex subject to recursively traverse dependencies. I myself vote for Gentoo on this, btw. The init scripts are quite elegant, and they just work.

      --
      Occam's razor is the blind faith in the natural selection of least resistance and in universal oversimplification. -- EF
    9. Re:FreeBSD 5's RCng by Anonymous Coward · · Score: 0
      witch init script

      BURN THEM!!!1

    10. Re:FreeBSD 5's RCng by Quinn · · Score: 0

      Yeah, and "I like software that isn't 3 years old" as an argument against Debian is a better troll.

      I don't know what the official filesystem definition of /usr/local is, but I use it for anything I personally install. Everything managed by the package manager goes into /usr, and everything I bring in and compile goes to /usr/local. That makes sense to me.

      --
      #19845
    11. Re:FreeBSD 5's RCng by mph · · Score: 1
      Everything managed by the package manager goes into /usr, and everything I bring in and compile goes to /usr/local. That makes sense to me.
      So now you're mixing up programs that are part of the OS, and third-party programs that are under package management.

      If you want /usr/local to be exclusively for non-package-managed software that you install yourself, then you should be putting package-managed software in a third place, like /opt, not /usr. This is trivial to do with FreeBSD's Ports Collection.

    12. Re:FreeBSD 5's RCng by Quinn · · Score: 1

      I guess this boils down to BSD being a true "system" whereas Linux is really just a kernel which is usually distributed with GNU tools. There's no accepted definition of what constitutes a "base" Linux system. Is it whatever was installed? Whatever it takes to be POSIX-compliant? Whatever some consortium of distributors says?

      For me, /usr/local is stuff I can't just apt-get back after a crash.

      --
      #19845
    13. 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.

    14. Re:FreeBSD 5's RCng by Quinn · · Score: 1

      perl -pi -e 's/(\bstable\b)/un$1/g;' /etc/apt/sources.list

      --
      #19845
    15. Re:FreeBSD 5's RCng by merdark · · Score: 1

      ohh... don't get me started on unstable. I tried that for a while (around a year). Needless to say, it deserves it's name. Besides, XFree 4.3 isn't even in unstable, it's in experimental. I mean, come on! Most other distros have been running 4.3 as stable for a long while now.

    16. Re:FreeBSD 5's RCng by Quinn · · Score: 1

      Yeah, I'll admit the lack of 4.3 kinda bothers me, inasmuch as I was wanting the RandR extension, but unstable has never given me any stability problems.

      In any case, agreed to disagree. :)

      --
      #19845
  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 atomic-penguin · · Score: 1, Insightful

      Init scripts can serve more purposes than just restarting. You can stop and start services with some init scripts. They are an important part of System Administration no matter how often you reboot.

      --
      /^([Ss]ame [Bb]at (time, |channel.)){2}$/
    2. 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!)

    3. Re:My init scripts by Stephen+Samuel · · Score: 1
      Init scripts concern my very little because I almost never reboot. .... my Gentoo box is nearing a month of uptime.

      A month? You're not even getting close to full bragging rights. I have one friend who lamented haveing to reboot his Sun after 3 years of uptime (had to flick a dip switch), and another spitting fire because someone at his colo provider f*cked up with the UPS system just about the time his box was set to bread one year of uptime.

      Netcraft notes that Linux (among others) has this minor bug in that the uptime counter wraps every 497.1 days. (units 2^32seconds/100 days) You can see it happening regulary in some of their uptime charts. Their "top 50" website uptimes range from 1000 to 1500 days.

      --
      Free Software: Like love, it grows best when given away.
    4. Re:My init scripts by 42forty-two42 · · Score: 1


      rc-update (add|del) (service) default
      rc


      Have fun.

    5. Re:My init scripts by Anonymous Coward · · Score: 0



      ..look at the top 50 uptimes though. It's almost all BSD based OSs with a smattering of Linux.

    6. Re:My init scripts by Stephen+Samuel · · Score: 1
      ..look at the top 50 uptimes [netcraft.com] though. It's almost all BSD based OSs with a smattering of Linux.

      That's because BSD/OS has about the same stability as Linux, but doesn't wrap it's uptime counter at 490 days. If Linux's counter didn't wrap, then I'd expect you to see a mix of BSD and Linux in the top 50. The Cable & Wireless 'linux' boxes 1000+ days uptime are most probably BSD boxes behind a Linux firewall, or something of that nature.

      (they have notes on how their OS guesses can sometimes be wrong).

      --
      Free Software: Like love, it grows best when given away.
    7. Re:My init scripts by Kethinov · · Score: 1

      It's called power outages due to crappy weather for which we get a lot of in Kansas. Not to mention the fact that since I'm a college student, my computers get shuttled around a lot between my house and my parents' house. >2 months of uptime is extremely difficult with such a lifestyle.

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

      2^32 seconds is 136 years.

    9. Re:My init scripts by Stephen+Samuel · · Score: 1
      So, other than power cycling (due to either weather or moving), your machine 'almost never reboots'... Still, in the Unix world rebooting every 2 monts or so still doesn't qualify as 'rarely'.. This differs greatly from the Windows world, where powering off every time you get up to go for coffee isn't entirely unheard of. Once you get stable (and perhaps buy yourself a UPS), you'll probably find that going 6 months without a reboot isn't at all strange.

      I dual boot my main box once in a while to play a Windows game (still not supported under wine). Other than that, the prime reasons for rebooting my box are: accidently knocked the power cable loose digging for something else; hardware changes ; playing with new kernels or installing new distributions.

      --
      Free Software: Like love, it grows best when given away.
  5. Meh by Captain+Goatse · · Score: 0

    I use the Slackware scripts(some hacks here and there).

    I have never felt the need to control whatever service is started at init, I never have many services either. And the ones I don't need I might as well start manually. Just a simple /etc/rc.d/rc.goatd start to start my goat daemon(I don't think there's such a thing, better check Goo gle to make sure), for example.

    I totally dislike the way the scipts are handled in RedHat and such popular distrubutions. I hate INODE spam, that's why I use devfs(yes, I know that it is deprecated, I'm also using a deprecated kernel(2.6.2-pre2, maybe), but as long as there are no problems I will not really care.).

  6. 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 Anonymous Coward · · Score: 0

      good point. That's ONE of the things I like about debian. I hardly ever have to worry about configuration files. And when I finally do, it's usually just answering a question or two about options inside the file.

    2. Re:Two things I hate about gentoo and on topic. by Doobian+Coedifier · · Score: 1

      Problem is you may have forgotten and then you could really break something.

      Hence, the diff output showing the difference between old and new. But you're right, it's the crappiest part of Gentoo, and it's a mistake everyone makes once (myself included). I think they're working on a better solution to this...

    3. 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.
    4. Re:Two things I hate about gentoo and on topic. by Anonymous Coward · · Score: 0

      I agree with everything you said. I'm also a Gentoo user and pleased with it in many respects. The developers aren't in the dark on this matter. As with a lot of things in Gentoo, this will take some time to get straightened out.

  7. SYS-V Baby by wang33 · · Score: 0, Troll

    I mean if we are going to pay sco to use linux we might as well use something besides errno.h and abi eh?

    But seriously I agree with the poster I love my sys-v init on SuSE

    Wang33

    --
    PAGERANK++ Robsell.com
  8. Grump by NanoGator · · Score: 2, Funny

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

    --
    "Derp de derp."
  9. BSD all the way! by redelm · · Score: 1
    This is a bit of a religious war, but I'll bite at the flamebait. I cannot abide Sys-V mess'o'symlinks, one reason I stay with Slackware, one of the only BSD-style distros.

    I like staying close to the metal on my machine. /etc/rc.local has my customization, other stuff is run manually from ~root/.bash_history. I don't like layers, and hence `linuxconf` is beneath contempt.

    1. Re:BSD all the way! by AKnightCowboy · · Score: 1
      This is a bit of a religious war, but I'll bite at the flamebait. I cannot abide Sys-V mess'o'symlinks, one reason I stay with Slackware, one of the only BSD-style distros.

      Well, considering I work daily on Solaris and Linux, it's really never been a question. Obviously Sys V init scripts are much easier to work with since Solaris uses them (and 90% of my admin work is Solaris).

      On the handful of machines that I work with that are BSD based, I've always found it VERY awkward to restart services. With sysv, it's just natural to type /etc/init.d/whatever restart or /etc/init.d/whatever stop && /etc/init.d/whatever start. I suppose BSD has ways to do this, but sysv's way is more elegant IMHO.

    2. Re:BSD all the way! by Micro$will · · Score: 1
      With sysv, it's just natural to type /etc/init.d/whatever restart or /etc/init.d/whatever stop && /etc/init.d/whatever start. I suppose BSD has ways to do this, but sysv's way is more elegant IMHO.

      Red Hat systems, and probably other SysV based distros have a service command.

      service foo stop/start/restart/status

      I also find it amusing how everyone using BSD initscripts seems to think a mess of symlinks is a bad thing, and that there's no easy way to manage them.

      chkconfig --list foo
      chkconfig --level 345 foo on
      chkconfig --level 2345 foo off
      chkconfig --add foo
      chkconfig --del foo

      There's no need to mess with or even look at the symlinks, just use the proper utility to manage them.

      I do have one RH/Fedora rant though: networking profiles. When I edit ifcfg-eth0 to change from static to dhcp or vice-versa I don't want some stupid script setting up my card to the last configuration. My quick fix was to copy ifcfg-lo to the real network-scripts directory and symlink /etc/sysconfig/networking to /dev/null.

  10. 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 unstable23 · · Score: 1

      Couple of thoughts:

      I cut my teeth on Solaris' sysV-stylee scripts so because I'm used to them, they don't bother me.

      As to RedHat - in 8.0 and higher, the official way to manage startup scripts (I believe) is using chkconfig. chkconfig is great, even tho I think it was stolen from IRIX.
      It lets you add/delete startup scripts into the sequence, muck with the order (by editing the script I think tho) and other bits and bobs. Very nice - I think it's great, and it saves a lot of symlink-wrangling.

      The NetBSD/FreeBSD startup scripts annoy me slightly now, but I'm probably just not au fait enough with the subtleties to be their Daddy.

    2. Re:Slackware's init by JDWTopGuy · · Score: 1

      Slackware rc.d dittoes. The only improvement I would make is to include a shutdown-time equivalent of rc.local. I named mine rc.local.6, and I just call it from rc.6.

      Patrick V., if you're reading... pleeeease?

      --
      Ron Paul 2012
    3. 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
    4. 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.

    5. Re:Slackware's init by alw53 · · Score: 1

      I actually went slackware one better and replaced all the scripts with one rc script that took a single argument to describe the runlevel. That way everything ended up in one file. It was a breeze
      to maintain.

    6. Re:Slackware's init by Anonymous Coward · · Score: 0

      Slackware definately has the best init scripts.

    7. 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.

  11. 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 CPlusPlusOwnsYou · · Score: 1

      There's nothing wrong with any of the scripts.
      I have used linux for 7 years now (mainly slackware and mandrake) and there is nothing wrong with any of the scripts IMO.

      --
      "Software is like sex: it's better when it's free."
    2. 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.

    3. Re:Slack's scripts are fine... by damien_kane · · Score: 1

      True enough, but most slackers know how to quickly restart somethign as simple as dhcpcd.
      As well, aside from the hostname to send (in the case of some broadband connections, like mine from Rogers/AT&T) most will know which interface is live and which is local.

      Slack's scripts aren't for n00bs, but they're not all that difficult though. As well, it's fairly easy to mod one of the ready-made rc.* scripts to start the service you need. Anyone with even light scripting experience should be able to do that.

  12. 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."

    1. Re:BSD-style by larien · · Score: 1
      "killall daemon" works just as well - in fact, that's all most stop scripts do
      Just make sure you don't transfer your script to Solaris, or unexpected results will occur. Hint: under Solaris, killall does exactly what it says on the tin; it kills all processes. Since Solaris 7, it's provided pkill for the same (if not greater) functionality as killall under linux etc.
  13. BSD sysv mix.... by josepha48 · · Score: 1
    Ideally there would be a mix.

    Having written my own init scripts and played with BSD, the one thing I miss in BSD is he ability to switch run levels. SysV is a bit much with run levels from 0 to 6. I'd like 3 run levels. single user, multi user, multi with X. I don't really think that the need for 0 and 6 is really there. Instead of saying init 0 or init 6 why not just say reboot or shutdown and skip the init sequence. That is about all I ever use. BSD has boot -s and multi, so if they were to adopt one more I'd be happy with them.

    Truth is most people only use 2 .. either runlevel 3 or 5 and single user mode....

    --

    Only 'flamers' flame!
    Does slashdot hate my posts?

    1. Re:BSD sysv mix.... by ctr2sprt · · Score: 1

      Single-user in Linux usually isn't, so there's a pseudo-runlevel that doesn't touch the init scripts at all. If memory serves, it's boot -e[mergency]. What a mess. Linux is a little too eager to depart from Unix tradition at times.

    2. Re:BSD sysv mix.... by __past__ · · Score: 1
      Interesting. I started with Linux, and mostly switched to BSD (first Open, now Free) about 2 years ago. Come to think of it, I never missed runlevels, and didn't even use them on Linux anyway.

      The distinction between single-user and multi-user is all I seem to need (by the way: your posting could be read as if BSD would require a reboot to go single-user. It doesn't, you can use 'init 1' or 'kill -TERM 1'). I don't use xdm or some such however, that might have something to do with that.

    3. Re:BSD sysv mix.... by Anonymous Coward · · Score: 0

      I'd like 3 run levels. single user, multi user, multi with X. I don't really think that the need for 0 and 6 is really there. Instead of saying init 0 or init 6 why not just say reboot or shutdown and skip the init sequence.

      Congratulations, you just described Slackware's init. :o)

  14. 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.

    1. Re:Gentoo's bootscripts do not use Python. by 42forty-two42 · · Score: 1

      The downside of this is that rc-update takes ages to update the deps. I'd like to see it use python or perl when available (when /usr is mounted), of bash when not.

  15. 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.
    1. Re:the BSD style changed by __aajelt3877 · · Score: 1

      Okay, so all the BSD guys are bashing runlevels. What's wrong with runlevels, exactly?

      To begin the discussion on the for side, here's one benefit to runlevels. You can specify which services are to be running at each runlevel: single, multi console, multi windowsystem, etc. The behavior is documented in a well known way, not a pile of custom scripts. So this is a benefit and a convenience.

    2. Re:the BSD style changed by Brandybuck · · Score: 1

      You really haven't stated why runlevels are useful. I wouldn't need to specify which services run in which runlevel, if I didn't have runlevels.

      For the life of me, I can't think of anytime I needed something other than single user or multiuser. (I'm not counting halt or reboot as runlevels). For example, all multiuser X gives you is xdm, so why not just start xdm from ttys if you want it?

      Or to put it another way, why are the three to five runlevels all that you need? If they're so useful, why not have fifteen or twenty? One for each user. Or one for each desktop. Or one for administration, one for games, one for word processing, one for development...

      --
      Don't blame me, I didn't vote for either of them!
    3. Re:the BSD style changed by Anonymous Coward · · Score: 0
      For the life of me, I can't think of anytime I needed something other than single user or multiuser.

      Single user mode, multi user mode, degraded modes. Sometimes i need ssh open but all mail services stopped. Or on a different server, ssh + web open, but databases down.

      But i'm just guessing; i use OpenBSD and /etc/rc is my drinking buddy.

    4. Re:the BSD style changed by T-Punkt · · Score: 1

      > The behavior is documented in a well known way, not a pile of custom scripts
      > So this is a benefit and a convenience.

      Same is true for the NetBSD way and even more so. Especially if you have to write your own startup scripts and feed it into the startup procedure.

      You have something called 'myservice', that must be started when the network is up, after the start of somedaemon but before xdm?

      Nothing simplier than that, just put special comments like this:

      # REQUIRE: NETWORKING somedaemon
      # BEFORE: xdm
      # PROVIDE: myservice

      in your startup script, rcorder will figure out the correct boot order for you automatically at boot time.

      You don't have to fuddle with bazillions of symlinks spread over dozen of directories with funny names like "S40nfs", "S30network" linking to "a pile of custom scripts" hidden somewhere else to get the order right.

      I think, the SYS-V init style was a good idea that hasn't thought up to the end. The result is an overly complex system. The NetBSD system was born out of the wish to make a system even more powerfull and flexible than the Sys V system, with individual startup scripts for every service as Sys V offers but without the Sys V complexity. And I think NetBSD fullfills that wish quite well with its automatic dependency ordering.

    5. Re:the BSD style changed by JDizzy · · Score: 1

      Well said.

      --
      It isn't a lie if you belive it.
  16. Gentoo +++ by n1ywb · · Score: 0, Troll

    I love Gentoo's system. It's everything an RC system should be and more. Everything else is antiquated junk IMO.

    --
    -73, de n1ywb
    www.n1ywb.com
    1. Re:Gentoo +++ by Anonymous Coward · · Score: 0

      Once again, proof that most Gentoo users are completely ignorant to everything around them outside the install guide.

    2. Re:Gentoo +++ by Per+Wigren · · Score: 1

      Once again, proof that most Gentoo users are completely ignorant to everything around them outside the install guide.

      Actually, in this case I think he is right! I'm not a Gentoo-zealot, Gentoo has a lot of bad sides, but its init-system is really friggin' great! How many of you people who are praising BSD or SysV-init style have actually TRIED Gentoo's SysV-inspired dependancy-based init? Because it is based on dependancies instead of a hardcoded order it can start services in parallell, really reducing startup time.. It can be set to stop services that depend on "net" when you stop networking, then when you start networking again it will restart them. It has lots of other features too!

      --
      My other account has a 3-digit UID.
    3. Re:Gentoo +++ by Anonymous Coward · · Score: 0

      Maybe you should look into what other people have to offer instead of just calling them "antiquated" by default.

    4. Re:Gentoo +++ by Anonymous Coward · · Score: 0

      I've never heard of anyone "praising" the SysV init system, because everyone seems to agree that while it's trying to solve an important problem, it's clunky and ugly.

      The most you will hear in "praise" of sysvinit is that it's "necessary."

  17. 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
  18. I really don't care, but. by BrookHarty · · Score: 1

    Its nice to have /etc/inittab for some workstations, but I could easily configure it in both styles. The only really annoying thing, different directories for startup scripts. I like /etc/init.d, so I have to symlink on some systems, just easier that way.

    BSD style seems a little more work, for no more gain.

  19. Re:Sounds like a lot of trouble by Anonymous Coward · · Score: 0

    Parent apparently decided to "minimise" grammer and "maximise" misspellings.

  20. 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.

  21. Re:Sounds like a lot of trouble by Paul+d'Aoust · · Score: 0, Offtopic

    okay, here in Canada, we have two official spellings: 'minimize' or 'minimise', and in the UK they go so far as to only use the second spelling. Anyway, it's sort of the pot calling the kettle black, seeing as 'grammar' is spelled with two A's.

    --
    Standing at the very edge of my imagination, I peered into the inky void and realised -- I couldn't think up a new sig.
  22. depends ... by Pegasus · · Score: 1, Insightful

    For setup and forget, you can't beat BSD init. Sure, as BSD boxen mostly fall into this category (servers).

    Now if you're tinkering with your box, you need something like runlevels and separate start/stop script for every daemon and some more things out there. Either traditional SysV or the new parallel style that's emerging from Gentoo and some other places.

    But in the end, you'll most likely stick with what your favourite distro provides.

  23. Red hat not too bad, once you get used to it. by smoon · · Score: 1

    I've got to say that I've gotten used to the "Red Hat Style" startup, especially in the past couple of years where you have an /etc/init.d/ directory to do things like /etc/init.d/httpd restart or whatever.

    One thing I've disliked about BSD style startup is that while there is a lot of potential, a busy admin is all-too-likely to just pop one more line in rc.local and call it good.

    It's nice not to have to recall every bizarre syntax for daemon restarts -- lets see, is it /usr/local/ndc restart, or was it kill -HUP `cat /var/run/named.pid`... A simple /etc/init.d/named restart takes care of it. Sounds like freebsd has a real similar way of doing this too.

    Look on the bright side -- anything is better than start->control panel->services->pick service->right-click->advanced tab->dependencies->etc. etc. yikes...

    --
    "But actually trying to use m4 as a general-purpose langage would be deeply perverse" --ESR
    1. Re:Red hat not too bad, once you get used to it. by macdaddy · · Score: 1

      LOL. I still don't bother with /etc/init.d/ABC stop. I still type out /etc/rc.d/init.d/mimedefang restart. :) Tab completion makes this very fast but still... I never have changed my mindset after RH started using /etc/init.d/. Oh well. No big loss.

    2. Re:Red hat not too bad, once you get used to it. by myz24 · · Score: 1

      Doesn't any one use the service command? Not the nitpick but I'm all for /etc/init.d/service_name_i_just_can't_remember but sometimes service httpd restart works nicely.

  24. 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.

  25. BSD by antizeus · · Score: 1

    I started with Slackware, which primarily uses BSD style scripts. Therefore it is more natural for me. The other way, conversely, seems unnatural.

    --
    -- $SIGNATURE
    1. Re:BSD by John+Hasler · · Score: 1

      I started with Unix System III, which had a single script. I now prefer sysvinit, however.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
  26. roll your own... by bergeron76 · · Score: 1

    If you're that worried about startup, why not roll your own scripts?

    Hell, I remember a great approach to starting/init'ing services using Makefiles a few months back. The article can be found here:
    http://lwn.net/Articles/50115/

    That article inspired me to create my own binary that gets called from init. My binary is basically just a static series of system() calls. I chose these over exec() because they require one less call to sh.

    Long story short - using a Makefile or a simple C binary can allow you to fine tune your startup. However, the flip side of this is that you'll have to know your system startup inside and out.

    --
    Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
  27. Daemontools svscan/supervise by MasterMnd · · Score: 1

    I've never really used runlevels at all, so I don't care much about that. What I do like is DJB's /service setup. It's easy to control daemons with the svc command, and if they ever crash they'll automatically be restarted.
    For a short time I as applying this system to as much of the system as possible. It was very nice but it was alot of work so I've not used it recently except for qmail and friends.

    Slackware's bsd-style init scripts were also good.

  28. 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/
    1. Re:Don't care, don't reboot enough... by ldspartan · · Score: 1

      Yes! Unfortnuately, you need daemons that don't background. But the daemontools package is great for writing your own stuff.

      --
      Phil

  29. From Slack to Gentoo by TekZen · · Score: 1

    I switched to Gentoo from Slackware a few months ago (I had been a slackware user for years).
    I moved to Gentoo for the package management. I really miss the simplicity of Slackware's init scripts. Maybe it is just because I used it for years, but they are really easy and simple. However, I mostly only use one runlevel on my laptop (and who cares about init scripts on my servers since they never get rebooted).
    I heard portage is getting ported to Slackware. I may have to go back to slackware.

    1. Re:From Slack to Gentoo by macdaddy · · Score: 1

      This is getting OT but how do you like Gentoo? I'm downloading the ISOs as we speak. I've been a RH user forever but I'm sick to death of RH9 and looking for something better. Is portage all it's cracked up to be? I compile all my daemons and most of my power tools by hand. I rarely use a RPM for anything anymore. Being able to upgrade a library and any library that depends on it at the drop of a hat would be ubber nice. I canned RH's sasl RPMs the other day and rolled my own only to find out that Rh statically linked all sorts of crap to the old libraries. Pine of all things is statically linked to RH's old sasl libraries. Avoiding this nightmare in the future sure would be nice. I'll miss my RH init scripts though. :(

    2. Re:From Slack to Gentoo by GimmeFuel · · Score: 1

      Sounds like you'll like Gentoo. You won't need to compile anything by hand anymore, but if you insist on doing so, portage provides the emerge --inject command, which tells it that a package you installed yourself is on the system and should not be considered an unsatisfied dependency.

    3. Re:From Slack to Gentoo by Khazunga · · Score: 1
      From your description, I guess you'll like Gentoo. Take the time to go through the docs (very good quality documentation), namely the USE variable configuration. You should be able to have portage compile all but the most exquisite packages for you, configured just the way you want it.

      Gentoo does have one problem. It'll make very easy to drive on the bleeding edge of libs/apps. Stay on the bleeding edge too long, and you'll see system breakage -- probabilities don't lie. My last one was on an upgrade from GCC minor versions, where I had to boot from rescue CD and recompile everything anew (laptop downtime of almost 24h, but recovery was unattended).

      --
      If at first you don't succeed, skydiving is not for you
    4. Re:From Slack to Gentoo by macdaddy · · Score: 1

      Hey thanks for the reply (both of ya'll). It sounds like Gentoo might be just what I need. I hope to get it installed in the next week or two. Thanks for the info!

  30. They both suck... by RockyMountain · · Score: 1

    ... because they both (as typically implemented, anyway) start/stop each servide one at a time. Way too much unnecessary serialization!

    A good system would explicitly know about dependencies, and would then concurrently start/stop everything for which the dependencies are already satisfied. That's what multi-tasking is for. Each time a daemon reports a successful start, all the other services whose dependencies are satisfied by it, would immediately be concurrently launched.

    Problem is, no distribution seems to have standardized an implementation of this, although I've heard of experimental examples.

    There's no good reason for computers to take forever to start and stop. We accept it because we're used to it. Aside from the fscking, the rest of the bootup should take only a few seconds.

    1. Re:They both suck... by Khazunga · · Score: 1
      A good system would explicitly know about dependencies, and would then concurrently start/stop everything for which the dependencies are already satisfied. That's what multi-tasking is for. Each time a daemon reports a successful start, all the other services whose dependencies are satisfied by it, would immediately be concurrently launched.
      You've just described Gentoo's init system, which builds a dependency graph, and can be configured to start/stop services concurrently (although that's not the default).
      --
      If at first you don't succeed, skydiving is not for you
    2. Re:They both suck... by RockyMountain · · Score: 1

      Thanks for the info.

      Gentoo's one of the few distro's I've never taken a look at. Mybe it's time for me to take a closer look.

  31. Why? by vga_init · · Score: 1
    I don't have real intimate knowledge of startup scripts, but I get along with them well enough (having written a few myself), and I just don't see what the huge fuss is about. After all, your system boots once, and once it's up then it's up. Being nice and flexible as *nix is, you can tweak system services to your heart's content while the thing is live; you wouldn't have to reboot for anything save kernel changes. Just make sure your system is configured to boot the way you want it most of the time and if you are in the mood for something different for whatever reason do it by hand after the fact (or write your own script to do the job if it has to be done often enough).

    Maybe I'm a bit old-fashioned with the "do-it-yourself" mentality, but I shy away from too much automation.

  32. 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 :))

    1. Re:Runit: the ONLY sane solution by __past__ · · Score: 1
      runit operates like DJB's daemontools but is tailored to run as process 0 in a unix system.
      Init is process 1 :-)
    2. Re:Runit: the ONLY sane solution by OdinHuntr · · Score: 1

      You're incredibly correct, thank you.

  33. 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".

  34. Slackware Conversion by MikeDawg · · Score: 1

    There are a couple of init styles associated with Slackware's booting. . . The basic, and most prominent laying around are the rc.d startup scripts. Slackware also has a directory in /etc/rc.d/ where you can put all your init.d scripts. It is actually an extremely easy conversion if you want to do it.

    --

    YOU'RE WINNER !
    Another lame blog

  35. 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.

  36. Well, that's not exactly a good way... by Ayanami+Rei · · Score: 1

    to shut down oracle.

    You stick dbshut inside /etc/init.d/oracle 's stop) section.

    If you want a controlled way to free resources which isn't handled by just sending a signal to a daemon, then it's nice to have a script that can handle it, and a procedure to call it.

    Plus it's also nice to link in a K99final script into rc0.d that does something like unlock all tapes in a carousel, send a message to a router or load balancer or whatever.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  37. 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.

  38. 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!

  39. fstab by eugene+ts+wong · · Score: 1

    I totally agree with you here. The very least that they should offer is: /dev/hda1 /boot /dev/hda2 swap /dev/hda3 /root

    Obviously, the more technical people can recommend something better, but the point should be clear.

    As for 2 tabs or whatever, I agree. I hate having to see a diff of 2 files that have no significant changes. They smarttened up a bit by automatically merging comments. I think that people should be shot when they just spacing because it wastes everybody's time.

    A cool option would be to autmatically merge init scripts but not the others.

  40. I usually preview, but apparently not this time. by eugene+ts+wong · · Score: 1
    Okay, for anybody who's interested, I've corrected the above text, but used bold to highlight 1 of the corrections. Sorry wasting your time.
    I totally agree with you here. The very least that they should offer is:
    /dev/hda1 /boot
    /dev/hda2 swap
    /dev/hda3 /root

    Obviously, the more technical people can recommend something better, but the point should be clear.

    As for 2 tabs or whatever, I agree. I hate having to see a diff of 2 files that have no significant changes. They smarttened up a bit by automatically merging comments. I think that people should be shot when they just change spacing without a specific reason [such as readability] because it wastes everybody's time.

    A cool option would be to autmatically merge init scripts but not the others.
  41. 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.

  42. 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?

  43. 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
  44. Good Thing by rixstep · · Score: 1

    It's a good thing you didn't put this in apple /., because by now otherwise you'd have everyone telling you their favourite was AppleScript.

  45. Re:I usually preview, but apparently not this time by aridhol · · Score: 1
    A cool option would be to autmatically merge init scripts but not the others.
    In make.conf: CONFIG_PROTECT_MASK=/etc/init.d
    --
    I can't say that I don't give a fuck. I've just run out of fuck to give.
  46. A couple interesting approaches... by Anonymous Coward · · Score: 1, Interesting

    The two ways that impress me the most are exact opposites: one is simple, and one is complicated.

    The first one I really like is OpenBSD. Their boot scripts are the most straightforward. It's all just a very simple shell script. I also like the idea of /etc/rc.conf.

    However, customizing those scripts could be a pain.

    The other example I really like has been well articulated by Richard Gooch, creator of Linux devfs (now labelled a failed experiment by kernel hackers). You can read about what Richard has to say here. This is the idea of boot scripts with dependencies. This idea still needs a little bit of work to be done well.

    I've often thought about writing my own boot scripts... It would be very simple, but also have dependencies, and track PIDs of daemons being run. It wouldn't have any runlevels, or, if it did, they would be easily redefinable.

  47. 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.

  48. Start, stop, and restart services by Beolach · · Score: 1
    I also liked having the scripts around to start, stop, and restart services.
    Slackware does have scripts to start/stop/restart most services, in /etc/rc.d. For example, to restart gpm run `/etc/rc.d/rc.gpm restart`.
    --
    Join moola.com, play games to earn money.
  49. BSD-style! by n0dez · · Score: 1

    I found BSD-style scripts much simpler than sys V; you don't have a bunch of directories and files lying around on FreeBSD and Slackware Linux. I also love the two "runlevels" of FreeBSD; single-user and multiuser, isn't that clear? :-)

  50. While we're on the subject... by bangular · · Score: 1

    While we're on the subject about things we don't like with Gentoo ;)

    It is very annoying that Gentoo's rc program was written in a compiled language. I feel as much as possible relating to init should be written in bash. I also don't like rc-update. Gentoo's init scripts are the most annoying things in the world. They aren't even bash scripts iirc. If you look at the top of one it's shebang is to another program (not running gentoo right now so I couldn't tell you which).

    Best init scripts I think are the ones from Linux from Scratch. It uses symlinking (/etc/rc.d/rc3.d etc. etc.). It is basically all written in bash. The init scripts are simple as hell. It comes with a templete init script so you can write your own in the same style. Has external functions for cleanly loading and killing the process (loadproc and killproc). Gentoo's overly cluttered init system just leads to very messy init scripts. K.I.S.S.