From owner-freebsd-questions Tue Oct 9 14:58:43 2001 Delivered-To: freebsd-questions@freebsd.org Received: from finch-post-10.mail.demon.net (finch-post-10.mail.demon.net [194.217.242.38]) by hub.freebsd.org (Postfix) with ESMTP id 6DB7C37B409 for ; Tue, 9 Oct 2001 14:58:36 -0700 (PDT) Received: from caomhin.demon.co.uk ([212.228.234.119]) by finch-post-10.mail.demon.net with esmtp (Exim 2.12 #1) id 15r4tV-000LA7-0A; Tue, 9 Oct 2001 21:58:34 +0000 Message-ID: Date: Tue, 9 Oct 2001 22:58:19 +0100 To: george Cc: questions@freebsd.org From: Kevin Golding Subject: Re: apache.sh PREFIX problem References: <000801c15101$138dc5c0$0100a8c0@thunderbird> <001a01c1510a$52158770$0100a8c0@thunderbird> In-Reply-To: <001a01c1510a$52158770$0100a8c0@thunderbird> MIME-Version: 1.0 X-Mailer: Turnpike Integrated Version 5.01 U Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <001a01c1510a$52158770$0100a8c0@thunderbird>, george writes >I couldnt figure out all that case stuff so I made my own script >I tried to run the commented out version you sent but I was still getting >and error below is what i came up with > > >what do you think? Erm, well if it works then hey, but I'd be a little surprised if it did. The case stuff you left out is the start and stop signal. Basically you just want to remove the if statement at the top and put the path in yourself to replace the ${PREFIX} throughout the script. It's not the prettiest solution I admit but it should work. It means you're basically just doing the search for where apachectl is by yourself. If you still have trouble after that then you need more help than I can manage. :-) Kevin, kludgey but working :-) >laptop# cat apache.sh > >#!/bin/sh > >if [ -x /usr/local/sbin/apachectl ] >then /usr/local/sbin/apachectl start > /dev/null && echo -n ' apache' >fi >if [ -r /var/run/httpd.pid ] >then /usr/local/sbin/apachectl stop > /dev/null && echo -n ' apache' >fi >laptop# > >----- Original Message ----- >From: "Kevin Golding" >To: "george" >Sent: Tuesday, October 09, 2001 1:42 PM >Subject: Re: apache.sh PREFIX problem > > >> In message <000801c15101$138dc5c0$0100a8c0@thunderbird>, george >> writes >> > I can start apache manually but my installled apache.sh wont start >> > it >> > it pukes on >> > >> > laptop# ./apache.sh >> > ./apache.sh: Cannot determine the PREFIX >> > laptop# >> > >> > >> > here is the apache.sh file that was installed using the ports. >> > I suspect its something in that "\(/.*\)/etc mess but i am not a >> > scripter and >> > have no idea what to put in there or take out for that matter... >> >> A script guru will probably suggest something better but this will work: >> >> >> #!/bin/sh >> >> #if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then >> # echo "$0: Cannot determine the PREFIX" >&2 >> # exit 1 >> # fi >> >> case "$1" in >> start) >> [ -x usr/local/sbin/apachectl ] && /usr/local/sbin/apachectl >> start > /dev >> /null && echo -n ' apache' >> ;; >> stop) >> [ -r /var/run/httpd.pid ] && /usr/local/sbin/apachectl stop >> > /dev/null & >> & echo -n ' apache' >> ;; >> *) >> echo "Usage: `basename $0` {start|stop}" >&2 >> ;; >> esac >> >> exit 0 >> >> >> Basically your prefix is most likely /usr/local if you installed from >> ports, if you're starting manually you know this :-) -- kevin@caomhin.demon.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message