Sitesctl
From ISPWiki
Contents |
Functions
The utility can be used for:
- getting information about a required site.
- Redistributing sites among processing web-servers.
- Stopping/starting/restarting all web-servers, or those ones that process a certain site. Web-server are managed via the cluster protocol, see oproxy.conf.
- Creating a symbolic link to a newly created user in directories of web-server configuration files.
- Deleting a symbolic link to a specified user in directories of web-server configuration files.
Getting site information
sitesctl --describe-site host.com sitesctl -ds host.com
Get information about the host.com site. You can provide the main name of the site, any of its aliases or auto-subdomain. You can also select ALL as a special site name. In this case information about all sites will be shown.
Redistributing sites among web-servers
sitesctl --distribute
Sites will be distributed among processing web-servers as follows:
- Each site should be located at least on N nodes, where N is the 9th field from cluster_sites.conf. Nodes load should be distributed regularly, if possible. The more load a user creates, on the more number of nodes he will reside on. The number of user sites, rather than actual load is currently considered. I.e. the more sites a user has, the greater load he creates.
- To minimize the size of Apache processes, each web-server inside a node should have the same number of sites.
After distribution, a new cluster_sites.conf will be written, modified web-servers will restart. oProxy will automatically read a new cluster_sites.conf within 5 seconds.
Managing web-servers
The utility receives a set of keys for managing web-servers:
- --stop
- Stop web-servers.
- --start
- Start web-servers.
- --restart
- Restart web-servers.
- --graceful
- Restart web-servers without breaking current connection.
Keys may receive the following parameters:
- site name, its alias or auto-subdomain
- the command will be applied only to those web-servers that process the specified site.
- ALL
- the command will be applied to all known web-servers.
- LOCAL
- the command will be applied only to local web-servers.
Examples
sitesctl --restart site.com
or
sitesctl --restart www.site.com
Restart the web-servers that process site.com.
sitesctl --start someautosubdomain.site.com
Start the web-servers that someautosubdomain.site.com.
sitesctl --start LOCAL
Start local web-servers
sitesctl --stop ALL
Stop all the web-servers that are specified in cluster_nodes.conf.
Creating a new user
sitesctl --link-new-user user_name
In this mode, the utility locates all the web-servers with DefaultForNewUsers option in cluster_nodes.conf, creates a symbolic link to the virtual host configuration file in the web-servers directories and returns the list of all modified web-servers to STDOUT.
Deleting a user link
sitesctl --unlink-user user_name
All symbolic links to the virtual host configuration file of the specified user will be removed from web-servers directories.
