Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I followed the directions of the Apache Docs online. I have done a default install. I can start and stop the server but before I did a fresh install, I could run:
Code:
/sbin/service httpd start
and I'd get the little [OK] when things went well. How can I reset that up? Thanks, Jeremy
Look into /etc/rc.d/init.d, browse the files and find the one you find easiest to modify. Change programname to right Apache path and see if it works. After some modifications it will work.
There in lies the problem. I don't have a /etc/rc.d/init.d/httpd file. I need one. I either need someone to attach theirs or send me the code to create my own. Thanks, Jeremy
I hate to be a burden but I'd really like to have someone's /etc/rc.d/init.d/httpd source so that I could do it the old way. I know it seems dumb but once you get used to something, you get used to it. All you have to do is:
Code:
kedit httpd
Copy, paste and BOOM, I'm cooking again. Thanks, Jeremy
The thing is that I don't have it. But my boyfriend has a copy of his old one, so I can paste it.
I'm not really sure if it's a good idea. The file is quite long and symlinking apachectl seems to be a beter idea.
But...If you really want it... I hope there are longer posts...
Quote:
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
unset LS_COLORS KDE_DISPLAY BROWSER HELP_BROWSER GTK_RC_FILES XMODIFIERS
unset COLORTERM DISPLAY LOGNAME SESSION_MANAGER KDE_INITIAL_DESKTOP
unset TERM HOME USERNAME PWD ENV USER TMP TMPDIR
### Hack for Status
LYNX="lynx -dump"
STATUSURL="http://localhost/server-status"
STATUSURLPERL="http://localhost:8200/server-status"
# Change the major functions into functions.
moduleargs() {
moduledir=/usr/lib/apache
moduleargs=
for module in ${moduledir}/*.so ; do
if [ -x ${module} ] ; then
module=`echo ${module} | awk '{
gsub(".*/","");
gsub("^mod_","");
gsub("^lib","");
gsub(".so$","");
print toupper($0)}'`
moduleargs="${moduleargs} -DHAVE_$module"
fi
done
echo ${moduleargs}
}
# Get the extra modules so only the main server gets them
extramoduleargs() {
extramoduledir=/usr/lib/apache-extramodules
extramoduleargs=
for extramodule in ${extramoduledir}/*.so ; do
if [ -x ${extramodule} ] ; then
extramodule=`echo ${extramodule} | awk '{
gsub(".*/","");
gsub("^mod_","");
gsub("^lib","");
gsub(".so$","");
print toupper($0)}'`
extramoduleargs="${extramoduleargs} -DHAVE_$extramodule"
fi
done
echo ${extramoduleargs}
}
### Hacks for the apache + proxified apache-mod_perl
# Assign all extra modules to both servers first
APACHEXMODS=`extramoduleargs`
PERLXMODS=`extramoduleargs`
COMMONMODS=`moduleargs`
#If both servers are installed, perl runs as a proxy
#and has no extra modules
if [ -x /usr/sbin/httpd -a -x /usr/sbin/httpd-perl ]; then
DEFINE="-DPERLPROXIED"
PERLXMODS=""
fi
PERLFILE="-f /etc/httpd/conf/httpd-perl.conf"
###
## Hack for ApacheJServ that takes forever to shut down and restart
snooze() {
for count in 1 2 3 4 5 6 7 8 9 ; do gprintf "."; sleep 1; done
echo
}
conftest() {
badconf=0
if [ -x /usr/sbin/httpd ]; then
action "Checking configuration sanity for httpd: " \
/usr/sbin/httpd -t \
$DEFINE $APACHEXMODS $COMMONMODS
badconf=$?
fi
if [ -x /usr/sbin/httpd-perl ]; then
action "Checking configuration sanity for httpd-perl: " \
/usr/sbin/httpd-perl -t \
$PERLFILE $DEFINE $PERLXMODS $COMMONMODS
[ $badconf = 0 ] && badconf=$?
fi
return $badconf
}
start() {
for tries in 1 2 3; do
if [ -x /usr/sbin/httpd-perl -a ! -e /var/run/httpd-perl.pid ]; then
if [ $tries -eq 1 ]; then gprintf "Starting httpd-perl: ";fi
daemon httpd-perl $PERLFILE $DEFINE $PERLXMODS $COMMONMODS
echo
for wait in 1 2 3 4 5;do
if [ ! -e /var/run/httpd-perl.pid ]; then sleep 1;fi
done
fi
if [ -x /usr/sbin/httpd -a ! -e /var/run/httpd.pid ]; then
if [ $tries -eq 1 ]; then gprintf "Starting httpd: ";fi
daemon httpd $DEFINE $APACHEXMODS $COMMONMODS
echo
for wait in 1 2 3 4 5;do
if [ ! -e /var/run/httpd.pid ]; then sleep 1;fi
done
fi
done
touch /var/lock/subsys/httpd
}
stop() {
if [ -x /usr/sbin/httpd-perl -a -e /var/run/httpd-perl.pid ]; then
gprintf "Shutting down httpd-perl: "
killproc httpd-perl
echo
rm -f /var/run/httpd-perl.pid
fi
if [ -x /usr/sbin/httpd -a -e /var/run/httpd.pid ]; then
gprintf "Shutting down httpd: "
killproc httpd
echo
if [ -e /usr/lib/apache-extramodules/mod_jserv.so ]; then
snooze
while [ -e /var/run/httpd.pid ]; do
echo Trying harder
snooze
killproc httpd
done
fi
rm -f /var/run/httpd.pid
fi
rm -f /var/lock/subsys/httpd
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
extendedstatus)
$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
echo
gprintf "#######################################"
gprintf "#######################################\n"
if [ -x /usr/sbin/httpd -a -x /usr/sbin/httpd-perl ]; then
$LYNX $STATUSURLPERL | awk ' /process$/ { print; exit } { print } '
echo
gprintf "#######################################"
gprintf "#######################################\n"
fi
;;
status)
echo
if [ -e /var/run/httpd.pid ]; then
gprintf "Apache is running.\n"
gprintf "httpd: `pidof httpd`\n"
echo
fi
if [ -e /var/run/httpd-perl.pid ]; then
gprintf "Apache-mod_perl is running.\n"
gprintf "httpd-perl: `pidof httpd-perl`\n"
echo
fi
if [ ! -e /var/run/httpd.pid -a ! -e /var/run/httpd-perl.pid ]; then
gprintf "Apache is *not* running.\n"
echo
fi
gprintf "Use %s extendedstatus for more information.\n" "$0"
echo
;;
restart)
stop
start
;;
update|condrestart)
if [ -e /var/run/httpd.pid -o -e /var/run/httpd-perl.pid ]; then
stop
conftest || exit $?
start
fi
;;
reload|graceful)
if [ -e /usr/lib/apache-extramodules/mod_jserv.so ]; then
stop
start
else
if [ -x /usr/sbin/httpd -a -e /var/run/httpd-perl.pid ]; then
gprintf "Reloading httpd-perl: "
killproc httpd -USR1
echo
fi
if [ -x /usr/sbin/httpd -a -e /var/run/httpd.pid ]; then
gprintf "Reloading httpd: "
killproc httpd -USR1
echo
fi
fi
;;
configtest)
conftest
exit $?
;;
*)
gprintf "Usage: %s {start|stop|restart|reload/graceful|update|status|configtest}\n" "$0"
exit 1
esac
Thanks Mara. I appreciate your help. I think that symlinking is "easier" and it might be my best bet. I do think that I'd like to look at your post so that I can see how I can make Apache a service like the /etc/rc.d/init.d/httpd file does. With that file, you can also make it where you can open the "Services" tool from the GUI and start and stop it from there. I thank you, Jeremy
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.