Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to understand the difference between service restart [someservice] and service reload [someservice]. I understand that "restart" restarts the service whereas "reload" reloads the configuration, but I don't understand the practical implications of this well enough to determine which I should use in a given context.

An example: most guides I've read for setting up PostgreSQL say that, once I've edited postgresql.conf and pg_hba.conf to allow remote connections, I should issue sudo service postgresql restart. However, if I were guessing which to use based on the description above I would choose "reload".

In case it matters, I'm on Ubuntu 11.10 - though I'm hoping for as generally applicable an explanation as possible.

share|improve this question
add comment

4 Answers

up vote 6 down vote accepted

What you said is correct, reload tells the service to reload it's configuration files, so that should be sufficient to reload the config, However there may be certain services that "don't follow the rule" or that won't reload config files, your probably safer with restart, I personally do not use postgresql, so i don't know. hope this helps

share|improve this answer
add comment

Not all services support reload. For those that do, it is usually preferable to restarting (i.e. reloading causes less or no downtime).

The Debian Policy Manual specifies that every /etc/init.d/ script should support a force-reload action, which means reload if the service supports it, and restart if the service doesn't support reloading.

I'm not sure how that translates into the modern Ubuntu upstart world.

share|improve this answer
    
The Debian Policy Manual was really useful link, thanks. –  RichardWigley Mar 22 at 15:52
add comment

currently if a service needs kicking (e.g. a config file changed) you can notify the service, but this leads to a restart. It would be nice if a reload was done if the service was already running (although I suppose there are bound to be some services which require restarts for some files, reloads for others).

The most complex example I can think of is something like Apache. Normally you can just ask it to reload, however sometimes you need to request a restart instead (if you add/remove modules for example).

share|improve this answer
add comment

postgres is a good example for big differences between reload and restart, because the later has to disconnect all database-clients.

when the connections should not rollback, you can stop the service without a "--force" at first by using pg_ctlcluster.

in /etc/postgres/{version}/{dbname}/postgresql.conf and at http://www.postgresql.org/docs/manuals/ every parameter has a remark like "This parameter can only be set at server start."

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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