Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I auto-start a site when the config file for it is created?

Ubuntu Server 13.10 Apache

share|improve this question
up vote 2 down vote accepted

The best option would be to do a graceful restart (service apache2 reload) in order to have the config become active without downtime (the new process takes over the listener while the old process completes any active requests).

To automate this you'd need something watching the files then restarting the service.. probably not worth the effort if you're creating the site files manually.

Instead, consider using some kind of configuration management like Puppet or Chef to manage the site config files, which can then be configured to run that graceful restart every time it changes one of those files.

share|improve this answer
The sites files will end up being created automatically, through a PHP script. – Kevin Feb 12 '14 at 20:30
@o7thWebDesign Then either have PHP run the service reload (use sudoers to let it mess with the service, but do not let it run any other commands as root), or have something running (could just be a cron job) that will watch for changes in that directory and run the graceful restart if changes are detected? – Shane Madden Feb 12 '14 at 20:33
Don't forget inotify. – Iain Feb 12 '14 at 20:51

Your Answer


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.