Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Ubuntu Server 13.10 Apache

share|improve this question

1 Answer 1

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 at 20:30
1  
@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 at 20:33
1  
Don't forget inotify. –  Iain Feb 12 at 20:51

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.