Added support for reading from stdin.

This commit is contained in:
Louwrentius 2010-04-03 16:55:36 +00:00
parent 3f1b96e1bb
commit 8b7944dad7
2 changed files with 22 additions and 10 deletions

30
ppss
View File

@ -25,7 +25,7 @@ trap 'kill_process' SIGINT
# Setting some vars. # Setting some vars.
SCRIPT_NAME="Distributed Parallel Processing Shell Script" SCRIPT_NAME="Distributed Parallel Processing Shell Script"
SCRIPT_VERSION="2.61" SCRIPT_VERSION="2.62"
# The first argument to this script can be a mode. # The first argument to this script can be a mode.
MODES="node start config stop pause continue deploy status erase kill ec2" MODES="node start config stop pause continue deploy status erase kill ec2"
@ -1442,7 +1442,7 @@ get_all_items () {
then then
log DEBUG "Running as slave, input file has been pushed (hopefully)." log DEBUG "Running as slave, input file has been pushed (hopefully)."
fi fi
if [ ! -e "$INPUT_FILE" ] if [ ! -e "$INPUT_FILE" ] && [ ! "$INPUT_FILE" == "-" ]
then then
log ERROR "Input file $INPUT_FILE does not exist." log ERROR "Input file $INPUT_FILE does not exist."
set_status "ERROR" set_status "ERROR"
@ -1450,15 +1450,27 @@ get_all_items () {
exit 1 exit 1
fi fi
exec 10<"$INPUT_FILE" if [ ! "$INPUT_FILE" == "-" ]
then
exec 10<"$INPUT_FILE"
while read LINE <&10 while read LINE <&10
do do
ARRAY[$count]=$LINE ARRAY[$count]=$LINE
((count++)) ((count++))
done done
exec 10>&-
else
log DEBUG "Reading from stdin.."
while read LINE
do
ARRAY[$count]=$LINE
((count++))
done
fi
exec 10>&-
fi fi

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
DEBUG="$1" DEBUG="$1"
VERSION="2.61" VERSION="2.62"
TMP_DIR="ppss" TMP_DIR="ppss"
PPSS=./ppss PPSS=./ppss
PPSS_DIR=ppss_dir PPSS_DIR=ppss_dir