Monthly Archives: May 2009

apachectl : Beauty of apache controller interface

Every tired to change apache config from a program and then wondered how to restart apache. Here’s a solution. APACHECTL.

When you do restart of apache, it will kill all the current sessions. But with apachectl you have option to restart the server gracefully without killing any previous sessions. This way all further connections will take up the new settings.

I’ve been doing this for a small little experiment, I wanted to add dynamic subdomains, So I had to edit the apache host httpd.conf files and we all know we have to restart the server after any config file is changed. So here’s an alternative. Change the config files from your PHP or CGI etc, and then call this apachectl.

The command is :  apachectl graceful

For Ubuntu and debian system the command would be : apache2ctl graceful

Here are some quick references from Apache’s official page:

start
Start the Apache httpd daemon. Gives an error if it is already running. This is equivalent to apachectl -k start.
stop
Stops the Apache httpd daemon. This is equivalent to apachectl -k stop.
restart
Restarts the Apache httpd daemon. If the daemon is not running, it is started. This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn’t die. This is equivalent to apachectl -k restart.
fullstatus
Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynx available on your system. The URL used to access the status report can be set by editing the STATUSURL variable in the script.
status
Displays a brief status report. Similar to the fullstatus option, except that the list of requests currently being served is omitted.
graceful
Gracefully restarts the Apache httpd daemon. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them. This command automatically checks the configuration files as in configtest before initiating the restart to make sure Apache doesn’t die. This is equivalent to apachectl -k graceful.
configtest
Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error. This is equivalent to apachectl -t.

The following additional option is available, but deprecated.

startssl
This is equivalent to apachectl -k start -DS

Notes from China

I really enjoyed my recent trip to China. I would like to share with you some of my experiences.

My Flight was from Calcutta, India to Kunming, China. From Kunming a local flight to GuangZhou.

I really liked GuangZhou. Nice climate, nice young people! I was there to attend 105th International Import Export fair. Its not mykinda game of business altogether but I agreed to it thinking what’s the harm to explore.

I rather describe the entire visit in pictures.

c5 Canton Fair Ground

c3 Opening ceremony

c4 Fair Grounds

c2 Costs only USD 5000

c1 Area surrounding the fair

c6 Speaking on stage — software imports

c8 felicitation

c7 Pretty Girls dance show

shopp Shopping in GuangZhou

shp Fun!

From GuangZhou I went to HK and then back to Kunming. Overall it was a nice short trip and the fair was quite interesting!