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

16
ppss
View File

@ -25,7 +25,7 @@ trap 'kill_process' SIGINT
# Setting some vars.
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.
MODES="node start config stop pause continue deploy status erase kill ec2"
@ -1442,7 +1442,7 @@ get_all_items () {
then
log DEBUG "Running as slave, input file has been pushed (hopefully)."
fi
if [ ! -e "$INPUT_FILE" ]
if [ ! -e "$INPUT_FILE" ] && [ ! "$INPUT_FILE" == "-" ]
then
log ERROR "Input file $INPUT_FILE does not exist."
set_status "ERROR"
@ -1450,6 +1450,9 @@ get_all_items () {
exit 1
fi
if [ ! "$INPUT_FILE" == "-" ]
then
exec 10<"$INPUT_FILE"
while read LINE <&10
@ -1459,6 +1462,15 @@ get_all_items () {
done
exec 10>&-
else
log DEBUG "Reading from stdin.."
while read LINE
do
ARRAY[$count]=$LINE
((count++))
done
fi
fi

View File

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