init-script for gentoo

Discussion in 'Feedback/Feature Requests' started by ts77, Mar 17, 2005.

  1. ts77

    ts77 New Member

    yeah, just would like a useable init-script for gentoo (http://www.gentoo.org) in the distribution as the current one doesn't work there (it needs dependencies and such).
  2. mistwang

    mistwang LiteSpeed Staff

    Can you please provide more information about this issue?
    The lsws.rc is a very simple shell script which does not depend on any third party software. Unless the location for rc scripts is not /etc/init.d or /etc/rc.d/init.d on gentoo, it should work fine.

    Thank you.
  3. ts77

    ts77 New Member

  4. mistwang

    mistwang LiteSpeed Staff

    Thanks for the link, the differences are pretty dramatic. We will add a dedicate rc script for gentoo later.
    Is there an easy way to tell the type of Linux distribution? Gentoo or something else?

    Thanks.
  5. ts77

    ts77 New Member

    hmm, don't know how others check the type of distribution.
    AFAIK each distribution has a given file in /etc where it tells its version.
    i.e. for gentoo there is /etc/gentoo-release ... so if this file exists you could guess that its gentoo-linux ... but I'm no professional in this, just a user.
  6. mistwang

    mistwang LiteSpeed Staff

    Good, it should be pretty unique for gentoo. ;-)
    Came up with a simple rc script:

    Code:
    #!/sbin/runscript
    
    depend()
    {
            use net
    }
    
    start()
    {
            "%LSWS_CTRL%" start 2>/dev/null 1>&2
    }
    
    stop()
    {
            "%LSWS_CTRL%" stop 2>/dev/null 1>&2
    }
    
    restart()
    {
            "%LSWS_CTRL%" restart 2>/dev/null 1>&2
    }
    
    Wondering what is in the depend() section in Apache's rc script. ;-)

    Came up with a simple script, not sure it works or not, would you mind give it a try, need to replace %LSWS_CTRL% with the absolute path to lsws/bin/lswsctrl and run "rc-update add lsws default".

    Thanks.
  7. ts77

    ts77 New Member

    thanks, will try it later when I can reboot the machine to see if it really works :).

    you wanted to know whats in apaches depend-section?
    Code:
    depend() {
            need net
            use mysql dns logger netmount postgres
            after sshd
    }
    
    ... and the start/stop (just fyi)
    Code:
    start() {
            ebegin "Starting apache"
            env -i PATH=$PATH PERL5LIB=PERL5LIB /sbin/start-stop-daemon -o --quiet \
                    --start --startas /usr/sbin/apache \
                    --pidfile /var/run/apache.pid -- ${APACHE_OPTS}
            eend $?
    }
    
    stop() {
            ebegin "Stopping apache"
            /usr/sbin/apachectl stop >/dev/null
            start-stop-daemon -o --quiet --stop --pidfile /var/run/apache.pid
            eend $?
    }
    
    
    ... I guess the eend is for the return-code?
  8. ts77

    ts77 New Member

    yeah, worked. lsws is running again after a reboot now. thx.
  9. mistwang

    mistwang LiteSpeed Staff

    Thank you for those updates, end up with a rc script similar to Apache's. ;-)

    Code:
    #!/sbin/runscript
    
    depend()
    {
    	need net
    	use mysql dns netmount postgres
    	after sshd
    }
    
    start()
    {
    	ebegin "Starting LiteSpeed Web Server"
    	"%LSWS_CTRL%" start 2>/dev/null 1>&2
    	eend $?
    }
    
    stop()
    {
    	ebegin "Stopping LiteSped Web Server"
    	"%LSWS_CTRL%" stop 2>/dev/null 1>&2
    	eend $?
    }
    
    restart()
    {
    	ebegin "Restarting LiteSpeed Web Server"
    	"%LSWS_CTRL%" restart 2>/dev/null 1>&2
    	eend $?
    }
    
    Thanks!
  10. ts77

    ts77 New Member

    Looks good. Thx!
  11. MindTooth

    MindTooth New Member

    Can't I use this with other distroes, or do I need a new one?

    I now use Arch Linux, but they use /etc/rc.d/ instead of /etc.init.d/.


    Birger :)

    Ed1t: Copied the lsws.rc file. And it got solved. Missing the messages though.
    Last edited: Jun 4, 2009

Share This Page