Gentoo Archives: gentoo-alt

From: zAfi <nietonfir@×××××.com>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] init.d script for apache?
Date: Tue, 20 Oct 2009 19:32:57
Message-Id: 10dd6e220910201232y7317ebfbmdee0464657f3b507@mail.gmail.com
In Reply to: [gentoo-alt] init.d script for apache? by Piotr
1 yes: copy the following script (stolen shamelessly from macports) to
2 $prefix/etc/init.d/ and save it as apache2ctl
3 Then simply change the path to this script in $prefix/usr/sbin/apache2ctl
4
5 Keep in mind that your conf.d/apache2 file will be worthless, so you
6 have to pass all your apache2 options in that script.
7
8 ###### START
9
10 #!/bin/sh
11 #
12 # Licensed to the Apache Software Foundation (ASF) under one or more
13 # contributor license agreements. See the NOTICE file distributed with
14 # this work for additional information regarding copyright ownership.
15 # The ASF licenses this file to You under the Apache License, Version 2.0
16 # (the "License"); you may not use this file except in compliance with
17 # the License. You may obtain a copy of the License at
18 #
19 # http://www.apache.org/licenses/LICENSE-2.0
20 #
21 # Unless required by applicable law or agreed to in writing, software
22 # distributed under the License is distributed on an "AS IS" BASIS,
23 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 # See the License for the specific language governing permissions and
25 # limitations under the License.
26 #
27 #
28 # Apache control script designed to allow an easy command line interface
29 # to controlling Apache. Written by Marc Slemko, 1997/08/23
30 #
31 # The exit codes returned are:
32 # XXX this doc is no longer correct now that the interesting
33 # XXX functions are handled by httpd
34 # 0 - operation completed successfully
35 # 1 -
36 # 2 - usage error
37 # 3 - httpd could not be started
38 # 4 - httpd could not be stopped
39 # 5 - httpd could not be started during a restart
40 # 6 - httpd could not be restarted during a restart
41 # 7 - httpd could not be restarted during a graceful restart
42 # 8 - configuration syntax error
43 #
44 # When multiple arguments are given, only the error from the _last_
45 # one is reported. Run "apachectl help" for usage info
46 #
47 ARGV="$@"
48 #
49 # |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
50 # -------------------- --------------------
51 #
52 # the path to your httpd binary, including options if necessary
53 HTTPD='${EPREFIX}/usr/sbin/apache2 -D INFO -D LANGUAGE -D PHP5'
54 #
55 # a command that outputs a formatted text version of the HTML at the
56 # url given on the command line. Designed for lynx, however other
57 # programs may work.
58 LYNX="lynx -dump"
59 #
60 # the URL to your server's mod_status status page. If you do not
61 # have one, then status and fullstatus will not work.
62 STATUSURL="http://main.phoebe2:8080/server-info"
63 #
64 # Set this variable to a command that increases the maximum
65 # number of file descriptors allowed per child process. This is
66 # critical for configurations that use many file descriptors,
67 # such as mass vhosting, or a multithreaded server.
68 ULIMIT_MAX_FILES=""
69 # -------------------- --------------------
70 # |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
71
72 # Set the maximum number of file descriptors allowed per child process.
73 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
74 $ULIMIT_MAX_FILES
75 fi
76
77 ERROR=0
78 if [ "x$ARGV" = "x" ] ; then
79 ARGV="-h"
80 fi
81
82 case $ARGV in
83 start|stop|restart|graceful|graceful-stop)
84 $HTTPD -k $ARGV
85 ERROR=$?
86 ;;
87 startssl|sslstart|start-SSL)
88 echo The startssl option is no longer supported.
89 echo Please edit httpd.conf to include the SSL configuration settings
90 echo and then use "apachectl start".
91 ERROR=2
92 ;;
93 configtest)
94 $HTTPD -t
95 ERROR=$?
96 ;;
97 status)
98 $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
99 ;;
100 fullstatus)
101 $LYNX $STATUSURL
102 ;;
103 *)
104 $HTTPD $ARGV
105 ERROR=$?
106 esac
107
108 exit $ERROR
109
110 ###### END
111
112 Good luck! ;)
113
114 Btw, does anyone have a better solution? ;)
115
116 2009/10/20 Piotr <pajter@×××××.com>:
117 > Hello.
118 >
119 > Im just installed gentoo prefixed on my mac os x... Emerge apache, and
120 > already i have problem which i don't know how to resolve..
121 > There's no any init.d/ script.. so i tried to run apache by apache2ctl:
122 > piotrcichosz@MacBook ~ $ ./gentoo/usr/sbin/apache2ctl start
123 > ./gentoo/usr/sbin/apache2ctl: line 2:
124 > /Users/piotrcichosz/gentoo/etc/init.d/apache2: No such file or directory
125 > ./gentoo/usr/sbin/apache2ctl: line 2: exec:
126 > /Users/piotrcichosz/gentoo/etc/init.d/apache2: cannot execute: No such file
127 > or directory
128 >
129 > I googled for it but can't find any solution.. Do you have some idea maybe?
130 > Regards.

Replies

Subject Author
Re: [gentoo-alt] init.d script for apache? Piotr <pajter@×××××.com>