I'm using Ubuntu Server 9.04 and I've installed Apache2 on it.

I want to restart my Apache gracefully but I only can restarting it using this command:

/etc/init.d/apache2 restart

And if I'm not wrong it doesn't have graceful option parameter.

I don't have this command installed:

apachectl

thanks

Update

sudo /etc/init.d/apache2 graceful
 * Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}
link|improve this question

feedback

2 Answers

up vote 2 down vote accepted

On Ubuntu apachectl is /usr/sbin/apache2ctl

link|improve this answer
@lain Ok thanks. Is it normal that I don't get any feedback message after the command ? For example, when I use "apache2 restart" I can see 2 lines "Apache restarting..." but apache2ctl just doesn't provide any additional info. Maybe just because everything went well ? – Patrick Oct 8 '10 at 7:22
If there were any errors apache2ctl would report them. – Iain Oct 8 '10 at 7:44
feedback

/etc/init.d/apache2 accepts graceful parameter. reload parameter does the same. You can use either:

/etc/init.d/apache2 graceful

or

/etc/init.d/apache2 reload

to pass graceful parameter to apache2ctl

Edit:

It exists. look at source of /etc/init.d/apache2:

graceful | reload | force-reload)
    if ! $APACHE2CTL configtest > /dev/null 2>&1; then
                $APACHE2CTL configtest || true
                log_end_msg 1
                exit 1
            fi
            log_daemon_msg "Reloading web server config" "apache2"
    if pidof_apache > /dev/null ; then
                if $APACHE2CTL graceful $2 ; then
                    log_end_msg 0
                else
                    log_end_msg 1
                fi
            fi
;;
link|improve this answer
uhm.. not really apache2 graceful doesn't exist.. see my updated question. – Patrick Oct 8 '10 at 8:13
About apache2 reload: is it exactly like graceful ? – Patrick Oct 8 '10 at 8:14
Yes it does. See my edit. – Casual Coder Oct 8 '10 at 8:57
ok. Maybe your version does not have it. I am working now on 10.04. But reload should do the same as graceful if in doubt look at source of /etc/init.d/apache2 it should call at some point $APACHE2CTL graceful. – Casual Coder Oct 8 '10 at 9:07
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.