1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/bin/bash
- #set -e #(errexit) esce quando un comando ritorna un valore diverso da zero (non va bene per come è implementata la funzione monitor)
- set -u #tratta le variabili non definite come errori
- set -o pipefail #ritorna zero se tutto è andato a buon fine (di default guarda solo l'ultimo comando)
- command_parsed=0
- . functions
- . conf
- while getopts 'hms:k:' OPTION; do
- case "$OPTION" in
- m) #funzione monitor
- monitor
- ;;
- s) #funzione start
- node=$OPTARG
- if [ $node == '1' ];then
- start_1
- elif [ $node == '2' ];then
- start_2
- else
- start_node $node
- fi
- ;;
- k) #funzione kill
- node=$OPTARG
- if [ $node == '1' ];then
- kill_1
- elif [ $node == '2' ];then
- kill_2
- else
- kill_process $node
- fi
- ;;
- h)
- print_help
- ;;
- ?)
- print_usage
- exit 1
- ;;
- esac
- done
- if [ $command_parsed -eq 0 ]
- then
- print_usage
- fi
|