Excellent. Either add error as well ‘starcluster start -c cluster_template cluster_name > output.txt 2>&1’, or get rid of the ‘> output.txt’ to direct the output to the browser session, and wrap in <pre> </pre> tags (like the example), so you can see what the errors are (if any).
From: Sergio Mafra [mailto:sergiohmafra_at_gmail.com]
Sent: Friday, April 25, 2014 10:17 AM
To: MacMullan, Hugh; starcluster_at_mit.edu
Subject: Re: [StarCluster] Simple Web interface for StarCluster
Thanks for your answer,
What is happening is that if you issue commands like "ls -la", it works perfectly.
If you issue a StarCluster command like "starcluster listclusters"... it works.
but if you try to use"Starcluster start -c cluster_template cluster_name"... it doesn´t show any output and $output returns empty.
If you try to do another example, this is what is going to happen.
1. Try $ starcluster listclusters > output.txt (the file will have all output)
2. if you try $ starcluster start -c cluster_template cluster_name > output.txt (the file will be 0 bytes)
On Fri, Apr 25, 2014 at 9:40 AM, MacMullan, Hugh <hughmac_at_wharton.upenn.edu<mailto:hughmac_at_wharton.upenn.edu>> wrote:
If it’s not running ‘like expected’, how is it running? What version of PHP are you using? Does this script work for you:
$shellCommand = 'ls -lart';
$output = shell_exec($shellCommand);
For that function to work (in 5.3.X or earlier), you must turn off ‘safe_mode’ in your php.ini file. See manual http://www.php.net/manual/en/function.shell-exec.php
, and http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode
for details on safe modes.
Beyond that, you need to make sure apache user (or whatever you’re running as) has access to everything it needs. Be secure.
From: starcluster-bounces_at_mit.edu<mailto:starcluster-bounces_at_mit.edu> [mailto:starcluster-bounces_at_mit.edu<mailto:starcluster-bounces_at_mit.edu>] On Behalf Of Sergio Mafra
Sent: Friday, April 25, 2014 7:31 AM
Subject: [StarCluster] Simple Web interface for StarCluster
We use StarCluster for managing our clusters for running eletrical engineering purporses. The engineers want to deploy the clusters in AWS by themselves and we think that letting them access the StarCluster line interface and modifying the config file for expandig/reducing the number of nodes in a cluster could be dangerous and not so intuitive.
So, we decided to build a very simple web interface using Apache and PHP aiming to read the config file, expose the clusters and letting them increase or decrease the number of nodes among limits and starting or terminating the cluster with the new parameters.
We are not expert in PHP and could be not the best tool, but it´s proven to be a quick development. We will study other options like Python and Django in the near future.
The question is: how to execute a command like "starcluster start -c cluster_template cluster_name in PHP? We are trying to use a command like $output = shell_exec($shellCommand);where $shellCommand is "starcluster start -c ..." but it doesn´t run like expected. Any ideas?
Received on Fri Apr 25 2014 - 10:36:22 EDT