init-script for gentoo

mistwang

LiteSpeed Staff
#2
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.
 

mistwang

LiteSpeed Staff
#4
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.
 

ts77

Well-Known Member
#5
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.
 

mistwang

LiteSpeed Staff
#6
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.
 

ts77

Well-Known Member
#7
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?
 

mistwang

LiteSpeed Staff
#9
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!
 
#11
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:
Top