<% # Starts/stops a website on all running webservers # # Fields required # website # action (start|stop|restart) Z::import_query_string(); ( defined $::f{action} ) or ::Error( "Please provide an action" ); ( defined $::f{website} ) or ::Error( "Please provide a website name" ); $action = ($::f{action} eq "stop")?"Stop": ($::f{action} eq "restart")?"Restart": "Start"; (! -f "$ENV{ZEUSHOME}/webadmin/conf/sites/$::f{website}") and ::Error( "Website '$::f{website}' does not exist" ); $response = `$ENV{ZEUSHOME}/webadmin/bin/webctl --action=$action --vs=$::f{website} --quiet --html`; # If there is a referer send them back to that, otherwise send them # to the first page for the traffic light page. # # If there was a 'view' parameter in the URL, return to the main index # of virtual servers, displaying the named site if( defined $::f{view} ) { $back = "/apps/web/index.cgi?view=$::f{website}"; } else { $back = $::f{back}||"/apps/web/index.cgi"; } (! $response) and Z::redirect( $back ); %> <%= "$action website $::f{website}" %>

<% if ( $action eq "Stop" ) { Z::write "Stopp" } else { Z::write "$action" } %>ing website <%= $::f{website} %>

<%= $response %>

Back to controller