Renamed all command line options in long format that is more readable.

This commit is contained in:
Louwrentius 2009-03-01 23:25:16 +00:00
parent 1bdfe61490
commit 0a35341033
1 changed files with 120 additions and 125 deletions

245
ppss.sh
View File

@ -250,139 +250,134 @@ add_var_to_config () {
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case $1 in case $1 in
-config ) --config )
CONFIG="$2" CONFIG="$2"
if [ "$MODE" == "config" ] if [ "$MODE" == "config" ]
then then
if [ -e "$CONFIG" ] if [ -e "$CONFIG" ]
then then
echo "Do want to overwrite existing config file?" echo "Do want to overwrite existing config file?"
read yn read yn
if [ "$yn" == "y" ] if [ "$yn" == "y" ]
then then
rm "$CONFIG" rm "$CONFIG"
else else
echo "Aborting..." echo "Aborting..."
cleanup cleanup
exit exit
fi fi
fi fi
fi fi
if [ ! "$MODE" == "config" ] if [ ! "$MODE" == "config" ]
then then
source $CONFIG source $CONFIG
fi fi
if [ ! -z "$SSH_KEY" ] if [ ! -z "$SSH_KEY" ]
then then
SSH_KEY="-i $SSH_KEY" SSH_KEY="-i $SSH_KEY"
fi fi
shift 2 shift 2
;; ;;
-n ) --nodes )
NODES_FILE="$2" NODES_FILE="$2"
shift 2 shift 2
;; ;;
-f ) --sourcefile )
INPUT_FILE="$2" INPUT_FILE="$2"
add_var_to_config INPUT_FILE "$INPUT_FILE" add_var_to_config INPUT_FILE "$INPUT_FILE"
shift 2 shift 2
;; ;;
-d ) --sourcedir )
SRC_DIR="$2" SRC_DIR="$2"
add_var_to_config SRC_DIR "$SRC_DIR" add_var_to_config SRC_DIR "$SRC_DIR"
shift 2 shift 2
;; ;;
-D ) --command )
DAEMON=1 COMMAND=$2
add_var_to_config DAEMON "$DAEMON" if [ "$MODE" == "config" ]
shift 2 then
;; COMMAND=\'$COMMAND\'
-c ) add_var_to_config COMMAND "$COMMAND"
COMMAND=$2 fi
if [ "$MODE" == "config" ] shift 2
then ;;
COMMAND=\'$COMMAND\'
add_var_to_config COMMAND "$COMMAND"
fi
shift 2
;;
-h ) --help )
showusage showusage
exit 1;; exit 1;;
-j ) --hyperthreading )
HYPERTHREADING=yes HYPERTHREADING=yes
add_var_to_config HYPERTHREADING "yes" add_var_to_config HYPERTHREADING "yes"
shift 1 shift 1
;; ;;
-l ) --log )
LOGFILE="$2" LOGFILE="$2"
add_var_to_config LOGFILE "$LOGFILE" add_var_to_config LOGFILE "$LOGFILE"
shift 2 shift 2
;; ;;
-k ) --key )
SSH_KEY="$2" SSH_KEY="$2"
add_var_to_config SSH_KEY "$SSH_KEY" add_var_to_config SSH_KEY "$SSH_KEY"
if [ ! -z "$SSH_KEY" ] if [ ! -z "$SSH_KEY" ]
then then
SSH_KEY="-i $SSH_KEY" SSH_KEY="-i $SSH_KEY"
fi fi
shift 2 shift 2
;; ;;
-b ) --no-secure-copy )
SECURE_COPY=0 SECURE_COPY=0
add_var_to_config SECURE_COPY "$SECURE_COPY" add_var_to_config SECURE_COPY "$SECURE_COPY"
shift 1 shift 1
;; ;;
-o ) --outputdir )
REMOTE_OUTPUT_DIR="$2" REMOTE_OUTPUT_DIR="$2"
add_var_to_config REMOTE_OUTPUT_DIR "$REMOTE_OUTPUT_DIR" add_var_to_config REMOTE_OUTPUT_DIR "$REMOTE_OUTPUT_DIR"
shift 2 shift 2
;; ;;
-p ) --processes )
TMP="$2" TMP="$2"
if [ ! -z "$TMP" ] if [ ! -z "$TMP" ]
then then
MAX_NO_OF_RUNNING_JOBS="$TMP" MAX_NO_OF_RUNNING_JOBS="$TMP"
add_var_to_config MAX_NO_OF_RUNNING_JOBS "$MAX_NO_OF_RUNNING_JOBS" add_var_to_config MAX_NO_OF_RUNNING_JOBS "$MAX_NO_OF_RUNNING_JOBS"
shift 2 shift 2
fi fi
;; ;;
-s ) --server )
SSH_SERVER="$2" SSH_SERVER="$2"
add_var_to_config SSH_SERVER "$SSH_SERVER" add_var_to_config SSH_SERVER "$SSH_SERVER"
shift 2 shift 2
;; ;;
-S ) --script )
SCRIPT="$2" SCRIPT="$2"
add_var_to_config SCRIPT "$SCRIPT" add_var_to_config SCRIPT "$SCRIPT"
shift 2 shift 2
;; ;;
-t ) --transfer )
TRANSFER_TO_SLAVE="1" TRANSFER_TO_SLAVE="1"
add_var_to_config TRANSFER_TO_SLAVE "$TRANSFER_TO_SLAVE" add_var_to_config TRANSFER_TO_SLAVE "$TRANSFER_TO_SLAVE"
shift 1 shift 1
;; ;;
-u ) --user )
USER="$2" USER="$2"
add_var_to_config USER "$USER" add_var_to_config USER "$USER"
shift 2 shift 2
;; ;;
-v ) --version )
echo "" echo ""
echo "$SCRIPT_NAME version $SCRIPT_VERSION" echo "$SCRIPT_NAME version $SCRIPT_VERSION"
echo "" echo ""
exit 0 exit 0
;; ;;
* ) * )
showusage showusage
exit 1;; exit 1;;
esac esac
done done