How to set the order of init.d scripts. - Setup

This is a discussion on How to set the order of init.d scripts. - Setup ; Does the init.d script system have a way to set the order? I am running mydns which depends on mysql and the init.d sequence runs it before mysql starts, causing it to fail. Is there a way to rearrange the ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: How to set the order of init.d scripts.

  1. How to set the order of init.d scripts.

    Does the init.d script system have a way to set the order?

    I am running mydns which depends on mysql and the init.d sequence runs
    it before mysql starts, causing it to fail. Is there a way to
    rearrange the order of execution, even if they start and stop at the
    same runlevels?

    /voifc


  2. Re: How to set the order of init.d scripts.

    On 16 May 2007 13:30:31 -0700, voipfc wrote:
    > Does the init.d script system have a way to set the order?
    >
    > I am running mydns which depends on mysql and the init.d sequence runs
    > it before mysql starts, causing it to fail. Is there a way to
    > rearrange the order of execution, even if they start and stop at the
    > same runlevels?


    Number picks who runs first and for the same number they are executed
    in the order found. Usually seen with ls. Example for run level 2

    ls -al /etc/rc.d/rc2.d/*

  3. Re: How to set the order of init.d scripts.

    voipfc wrote:
    > Does the init.d script system have a way to set the order?
    >
    > I am running mydns which depends on mysql and the init.d sequence runs
    > it before mysql starts, causing it to fail. Is there a way to
    > rearrange the order of execution, even if they start and stop at the
    > same runlevels?
    >

    Yes. Look at my /etc/rc.d/rc5.d

    $ ls -l /etc/rc.d/rc5.d/
    total 0
    lrwxr-xr-x 1 root root 19 Dec 30 2004 K05saslauthd -> ../init.d/saslauthd
    lrwxr-xr-x 1 root root 16 Dec 30 2004 K10psacct -> ../init.d/psacct
    lrwxrwxrwx 1 root root 15 Dec 30 2004 K12canna -> ../init.d/canna
    lrwxr-xr-x 1 root root 14 Dec 30 2004 K24irda -> ../init.d/irda
    lrwxr-xr-x 1 root root 13 Dec 30 2004 K35smb -> ../init.d/smb
    lrwxr-xr-x 1 root root 19 Dec 30 2004 K35vncserver -> ../init.d/vncserver
    lrwxr-xr-x 1 root root 17 Dec 30 2004 K35winbind -> ../init.d/winbind
    lrwxr-xr-x 1 root root 17 Dec 30 2004 K50netdump -> ../init.d/netdump
    lrwxr-xr-x 1 root root 15 Dec 30 2004 K50snmpd -> ../init.d/snmpd
    lrwxr-xr-x 1 root root 19 Dec 30 2004 K50snmptrapd -> ../init.d/snmptrapd
    lrwxrwxrwx 1 root root 16 Dec 30 2004 K73ypbind -> ../init.d/ypbind
    lrwxrwxrwx 1 root root 14 Dec 30 2004 K74apmd -> ../init.d/apmd
    lrwxrwxrwx 1 root root 14 Dec 30 2004 K74nscd -> ../init.d/nscd
    lrwxrwxrwx 1 root root 15 Jul 20 2006 K89rdisc -> ../init.d/rdisc
    lrwxrwxrwx 1 root root 14 Dec 30 2004 K91isdn -> ../init.d/isdn
    lrwxrwxrwx 1 root root 16 Dec 30 2004 K96pcmcia -> ../init.d/pcmcia
    lrwxrwxrwx 1 root root 17 Dec 31 2004 S01sysstat -> ../init.d/sysstat
    lrwxr-xr-x 1 root root 15 Dec 30 2004 S05kudzu -> ../init.d/kudzu
    lrwxr-xr-x 1 root root 19 Dec 30 2004 S08ip6tables -> ../init.d/ip6tables
    lrwxr-xr-x 1 root root 18 Dec 30 2004 S08iptables -> ../init.d/iptables
    lrwxrwxrwx 1 root root 17 Jul 20 2006 S10network -> ../init.d/network
    lrwxr-xr-x 1 root root 16 Dec 30 2004 S12syslog -> ../init.d/syslog
    lrwxr-xr-x 1 root root 20 Dec 30 2004 S13irqbalance -> ../init.d/irqbalance
    lrwxr-xr-x 1 root root 17 Dec 30 2004 S13portmap -> ../init.d/portmap
    lrwxr-xr-x 1 root root 17 Dec 30 2004 S14nfslock -> ../init.d/nfslock

    I deleted some. They will be executed in the order shown.
    The first character of the link name tells if they process will be Killed or
    Started. The next two digits are the main part of the ordering, and the rest
    is just so you can tell what they are for. But the rest does affect the
    order. Normally, you try to put these all at the right order with the two
    digits. So you would have

    S50mysql -> ...
    S51mydns -> ...

    But pick the 50 and 51 so as to be higher than everything they depend on.

    --
    .~. Jean-David Beyer Registered Linux User 85642.
    /V\ PGP-Key: 9A2FC99A Registered Machine 241939.
    /( )\ Shrewsbury, New Jersey http://counter.li.org
    ^^-^^ 17:15:01 up 89 days, 4:44, 3 users, load average: 4.54, 4.39, 4.29

  4. Re: How to set the order of init.d scripts.

    On 16 May, 21:30, voipfc wrote:
    > Does the init.d script system have a way to set the order?
    >
    > I am running mydns which depends on mysql and the init.d sequence runs
    > it before mysql starts, causing it to fail. Is there a way to
    > rearrange the order of execution, even if they start and stop at the
    > same runlevels?


    On most Linux systems, the "chkconfig" command is used to read the
    chkconfig line in the init script and set the order appropriately.
    Take a look in /etc/rc.d/rc3.d to get a sense of what happens at
    runlevel 3, and at the contents of the files and the man page for
    chkconfig.


  5. Re: How to set the order of init.d scripts.

    voipfc writes:

    >Does the init.d script system have a way to set the order?


    >I am running mydns which depends on mysql and the init.d sequence runs
    >it before mysql starts, causing it to fail. Is there a way to
    >rearrange the order of execution, even if they start and stop at the
    >same runlevels?


    Yes. uhe order is determined by the number after the S in the runlevel
    /etc/rc3.d/S05able is run before /etc/rc3.d/S53baker and after
    /etc/rc3.d/S04teddy
    (that is in runlevel 3 For runlevel 5 look in /etc/rc5.d, etc)


    >/voifc



+ Reply to Thread