Web Hosting Talk







View Full Version : httpd... whats the difference....


chuckt101
01-06-2002, 03:31 PM
Server version: Apache/1.3.19 (Unix)
Redhat Linux 7.1

What's the diffrence between:

[root@localhost named]# httpd restart

and

[root@localhost named]# /etc/rc.d/init.d/httpd restart
which outputs:

Stopping httpd: [ OK ]
Starting httpd: [ OK ]


If I edit httpd.conf, which restart command do I need to use? What does each do anyway?

Thanks

smartbackups
01-06-2002, 03:33 PM
ether one is fine. You should use the one in rc.d, that way the .lock file will be generated and it is starting the way it is supposed to be. then again you may have that directory in your path and that is why it is working either way.

chuckt101
01-06-2002, 04:21 PM
the two httpd restart commands yeilds different results.

the simple httpd restart just returns the command prompt, but the one in the /etc/rc.d/init.d path does that stop/start stuff.

Plus, it seems I have to use the one in the /etc/.... path if I edit the httpd.conf file.

Synergy
01-06-2002, 05:39 PM
I use the /etc path :)

ffeingol
01-06-2002, 07:23 PM
And I would suggest that you use "graceful" instead of "restart". Restart just stops/starts the server reguardles of what is going on. Graceful waits for the current process (web connections) to finish so people browsing won't get funny errors.

Frank

serve-you
01-06-2002, 08:30 PM
Originally posted by aragon
the two httpd restart commands yeilds different results.

the simple httpd restart just returns the command prompt, but the one in the /etc/rc.d/init.d path does that stop/start stuff.

Plus, it seems I have to use the one in the /etc/.... path if I edit the httpd.conf file.

They both do the same function. The reason the rc.d file gives you the stop/start info, is becase it is a system startup script. It is written to echo the results at startup/shutdown, so that you can see the results in logs and such. You can use the command "apachectl" to stop/start apache, and get an echo.

-Dan

chuckt101
01-07-2002, 05:09 PM
Originally posted by serve-you


They both do the same function. The reason the rc.d file gives you the stop/start info, is becase it is a system startup script. It is written to echo the results at startup/shutdown, so that you can see the results in logs and such. You can use the command "apachectl" to stop/start apache, and get an echo.

-Dan

Well...I'd buy that.... except /etc/rc.d/init.d httpd restart takes about 5 seconds while "httpd restart" is pretty much instant. I'm thinking "echo [OK]" doesnt exactly require a lot of cpu time ;)

shrug... anyways.. no big deal... i'll just use the httpd command from /etc/rc.d/init.d from now on ;) :cool:

serve-you
01-07-2002, 07:48 PM
The rc.d script is just executing the "apachectl" script based on the status.

# Source function library.
. /etc/rc.d/init.d/functions

APACHE=/usr/local/sbin/httpd
APACHECTL=/usr/local/sbin/apachectl

[ -f $APACHE ] || exit 0
[ -f $APACHECTL ] || exit 0

# See how we were called.
case "$1" in
start)
echo -n "Starting httpd: "
$APACHECTL start
echo
touch /var/lock/subsys/httpd
;;
stop)
echo -n "Shutting down http: "
$APACHECTL stop
echo
rm -f /var/lock/subsys/httpd
;;
status)
$APACHECTL status
;;
restart)
$APACHECTL restart
;;
reload)
echo -n "Reloading httpd: "
killproc httpd -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

-Dan

ryno267
03-30-2004, 01:35 PM
with SU the "httpd restart" doesnt work for me.

the path "/etc/rc.d/init.d/httpd restart" in fact does though.

Is there any other way to restart the web server that is shorter? that works? lol.

I'm on redhat 9 something server and using putty as su.

thanks

youandme
03-30-2004, 02:19 PM
service httpd restart <-- i always use it and i dont think that it's different with /etc/rc.d/init.d/httpd restart

ryno267
03-30-2004, 02:51 PM
doesnt work for me...

i can use this too...

apachectl stop; apachectl start