Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: su & and password problems in init.d-scripts

  1. #11
    Join Date
    Mar 2008
    Beans
    4,715
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: su & and password problems in init.d-scripts

    Rename your symlinks as K74irctor instead of S74irctor.
    Scripts that start with 'K' are sent the stop command,
    Scripts that start with 'S' are sent the start command.
    Last edited by unutbu; July 3rd, 2008 at 05:59 PM.

  2. #12
    Join Date
    Apr 2008
    Location
    Germany - Berlin
    Beans
    340

    Re: su & and password problems in init.d-scripts

    Quote Originally Posted by unutbu View Post
    Rename your symlinks as K74irctor instead of S74irctor.
    Scritps that start with 'K' are sent the stop command,
    Scripts that start with 'S' are sent the start command.
    Thought so at frst too but I doubt it, it would make the commands like /etc/rc0.d/S60umountroot useless because they do nothing in their (start) branch of the switch/case tree.

  3. #13
    Join Date
    Mar 2008
    Beans
    4,715
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: su & and password problems in init.d-scripts

    http://www.debian.org/doc/debian-pol...tml#s-sysvinit

    When init changes runlevel first the targets of the links whose names start with a K are executed, each with the single argument stop, followed by the scripts prefixed with an S, each with the single argument start. (The links are those in the /etc/rcn.d directory corresponding to the new runlevel.) The K links are responsible for killing services and the S link for starting services upon entering the runlevel.

    For example, if we are changing from runlevel 2 to runlevel 3, init will first execute all of the K prefixed scripts it finds in /etc/rc3.d, and then all of the S prefixed scripts in that directory. The links starting with K will cause the referred-to file to be executed with an argument of stop, and the S links with an argument of start.

  4. #14
    Join Date
    Jun 2007
    Location
    Sweden
    Beans
    28
    Distro
    Ubuntu 8.04 Hardy Heron

    Talking Re: su & and password problems in init.d-scripts

    Ahhh that was the problem. Of course the soft links should begin with a k (kill) and not a s. I just tested it and it works!

    As some mentioned another variant is ti kill the whole screen process and maybe that is also OK. I imagined that sending a quit-message to the screen session, called irctor, would not be so harmful compared to just killing the whole screen process. I'm a right or wrong?

    Anyway thanks for all the help!
    /Ballena aka Erikw
    Goox.se - Search The Web
    "There are people who don't like capitalism, and people who don't like PCs. But there's no one who likes the PC who doesn't like Microsoft." - Bill Gates

  5. #15
    Join Date
    Jun 2007
    Location
    Sweden
    Beans
    28
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: su & and password problems in init.d-scripts

    One last question tho: Am I free to use what ever unused number for my softlink that I want? Maybe some numbers are not allowed to use or such.
    Goox.se - Search The Web
    "There are people who don't like capitalism, and people who don't like PCs. But there's no one who likes the PC who doesn't like Microsoft." - Bill Gates

  6. #16
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,442
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: su & and password problems in init.d-scripts

    I believe the numbers are executed in order. K00...K99. I guess they are just sorted alphabetically to be honest. There may be dependencies which influence your choice of which order things are started and stopped in.

  7. #17
    Join Date
    Mar 2008
    Beans
    4,715
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: su & and password problems in init.d-scripts

    Ballena and Gunman1982, what I said in post #11 is wrong (and Gunman1982 is correct in post #12), and it was only by dumb luck that my suggestion worked. According to
    http://www.debian.org/doc/debian-pol...ml#s-sysvinit:

    The two runlevels 0 (halt) and 6 (reboot) are slightly different. In these runlevels, the links with an S prefix are still called after those with a K prefix, but they too are called with the single argument stop.
    So Ballena, if your script works with K74, but does not work with S74, it must mean that S74 comes too late in the sequence. Something important (like S40umountfs) would prevent S74 from running because you can't run /bin/su if you there is no /bin.

    So moving the script to K74 did not succeed because of the K, it worked because it was simply earlier in the shutdown sequence. Perhaps S19irctor would have worked too, for example.

    This sheds some light on your last question, Ballena.

    Am I free to use what ever unused number for my softlink that I want?
    I am not sure for what the range of numbers your script will work. Perhaps experimentation is the easiest way to tell.

    I don't think you have to worry about numbers being "unused" however. If two scripts have the same number, I believe they are simply executed in alphabetical order.
    Last edited by unutbu; July 3rd, 2008 at 08:45 PM.

  8. #18
    Join Date
    Jun 2007
    Location
    Sweden
    Beans
    28
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: su & and password problems in init.d-scripts

    @unutbu: OK so I just had no luck at first. I will try to pick some lower numbers for my own /etc/init.d/ scripts. Thanks for the answer!
    Goox.se - Search The Web
    "There are people who don't like capitalism, and people who don't like PCs. But there's no one who likes the PC who doesn't like Microsoft." - Bill Gates

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •