PDA

View Full Version : init-script for gentoo


ts77
03-17-2005, 02:30 AM
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).

mistwang
03-17-2005, 08:33 AM
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.

ts77
03-17-2005, 08:39 AM
the location is /etc/init.d but it needs some tuning ;)
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

mistwang
03-17-2005, 10:11 AM
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
03-17-2005, 10:17 AM
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
03-17-2005, 10:35 AM
Good, it should be pretty unique for gentoo. ;-)
Came up with a simple rc script:


#!/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
03-17-2005, 12:07 PM
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?

depend() {
need net
use mysql dns logger netmount postgres
after sshd
}


... and the start/stop (just fyi)

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?

ts77
03-17-2005, 03:34 PM
yeah, worked. lsws is running again after a reboot now. thx.

mistwang
03-17-2005, 04:06 PM
Thank you for those updates, end up with a rc script similar to Apache's. ;-)


#!/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!

ts77
03-18-2005, 03:08 AM
Looks good. Thx!

MindTooth
06-04-2009, 05:09 AM
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.