diff options
Diffstat (limited to 'src/manage.sh')
-rwxr-xr-x | src/manage.sh | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/manage.sh b/src/manage.sh index 1cd3a03..ff3f88c 100755 --- a/src/manage.sh +++ b/src/manage.sh @@ -37,9 +37,9 @@ # $ sudo ./flufigut-client.sh install # -OUTPUT_DIR="output/flumotion" -SSH_KEY="id_rsa" -SSH_CONFIG="ssh.config" +OUTPUT_DIR="$1/flumotion" +SSH_KEY="$1/id_rsa" +SSH_CONFIG="$1/ssh.config" SSH_USER="flufigut" deploy_all() { @@ -66,7 +66,7 @@ clean_all() { } wipe_all() { - for machine in `grep "^Host" ssh.config | awk '{ print($2) }'`; do + for machine in `grep "^Host" $SSH_CONFIG | awk '{ print($2) }'`; do echo "wipeing files belonging to planet '$1' from $machine ... " ssh -i "$SSH_KEY" -F "$SSH_CONFIG" $SSH_USER@"$machine" wipe "$1" done @@ -130,7 +130,27 @@ stop_all() { done } -case "$1" in +print_usage() { + echo "flufigut management script by Christian Pointner <equinox@spreadspace.org>" + echo "" + echo "Usage $0 <planet> <command>" + echo "" + echo "Commands:" + echo " deploy copies all configuration file to all servers and installs them" + echo " clean remove all configuration file from all servers" + echo " wipe purges all configuration files belonging the planet" + echo " start starts all instances on all servers (manager starts first)" + echo " stop stop all instances on all servers (manager stops last)" + echo " restart same as stop, start" + echo " help prints this" +} + +if [ -z "$1" ]; then + print_usage + exit 1 +fi + +case "$2" in deploy) echo "Deploying configuration to all machines ..." deploy_all @@ -140,12 +160,8 @@ case "$1" in clean_all ;; wipe) - if [ -z "$2" ]; then - echo "Usage: $0 wipe <planet name>" - exit 1 - fi echo "wipeing configuration for from all machines inside ssh-config ..." - wipe_all "$2" + wipe_all "$1" ;; start) echo "Start manager and worker on all machines ..." @@ -162,21 +178,10 @@ case "$1" in start_all ;; help) - echo "flufigut managemnt script by Christian Pointner <equinox@spreadspace.org>" - echo "" - echo "Usage $0 <command> [param] " - echo "" - echo "Commands:" - echo " deploy copies all configuration file to all servers and installs them" - echo " clean remove all configuration file from all servers" - echo " wipe <planet> purges all configuration files belonging to a given planet" - echo " start starts all instances on all servers (manager starts first)" - echo " stop stop all instances on all servers (manager stops last)" - echo " restart same as stop, start" - echo " help prints this" + print_usage ;; *) - echo "Usage $0 (deploy|clean|wipe|start|stop|restart|help)" + echo "Usage $0 <name> (deploy|clean|wipe|start|stop|restart|help)" exit 1 ;; esac |