This commit is contained in:
Louwrentius 2009-02-28 18:42:16 +00:00
parent 39c1ecf542
commit ed55ae5137

117
ppss.sh
View File

@ -250,7 +250,7 @@ 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
@ -507,6 +507,21 @@ check_status () {
} }
erase_ppss () {
echo "Are you realy sure you want to erase PPSS from all nades!?"
read YN
if [ "$YN" == "y" ]
then
for x in `cat $NODES_FILE`
do
log INFO "Erasing PPSS from node $x."
exec_cmd "rm -rf $PPSS_HOME_DIR"
done
fi
}
deploy_ppss () { deploy_ppss () {
ERROR=0 ERROR=0
@ -1018,6 +1033,29 @@ start_all_workers () {
done done
} }
show_status () {
source $CONFIG
if [ ! -z "$SSH_KEY" ]
then
SSH_KEY="-i $SSH_KEY"
fi
if [ -z "$INPUT_FILE" ]
then
ITEMS=`exec_cmd "ls -1 $SRC_DIR | wc -l"`
else
ITEMS=`exec_cmd "cat $INPUT_FILE | wc -l"`
fi
PROCESSED=`exec_cmd "ls -1 $ITEM_LOCK_DIR | wc -l"`
#STATUS=`echo "100 * $PROCESSED / $ITEMS" | bc`
STATUS=$((100 * $PROCESSED / $ITEMS))
echo "$STATUS percent complete."
}
# If this is called, the whole framework will execute. # If this is called, the whole framework will execute.
main () { main () {
@ -1029,48 +1067,55 @@ main () {
case $MODE in case $MODE in
node ) node )
init_vars init_vars
test_server test_server
get_all_items get_all_items
listen_for_job "$MAX_NO_OF_RUNNING_JOBS" & listen_for_job "$MAX_NO_OF_RUNNING_JOBS" &
LISTENER_PID=$! LISTENER_PID=$!
start_all_workers start_all_workers
;; ;;
server ) server )
# This option only starts all nodes. # This option only starts all nodes.
init_vars init_vars
if [ ! -e "$NODES_FILE" ] if [ ! -e "$NODES_FILE" ]
then then
log INFO "ERROR file $NODES with list of nodes does not exist." log INFO "ERROR file $NODES with list of nodes does not exist."
cleanup cleanup
exit 1 exit 1
else else
for NODE in `cat $NODES_FILE` for NODE in `cat $NODES_FILE`
do do
start_ppss_on_node "$NODE" start_ppss_on_node "$NODE"
done done
fi fi
;; ;;
config ) config )
log INFO "Generating configuration file $CONFIG" log INFO "Generating configuration file $CONFIG"
cleanup cleanup
exit exit 0
;; ;;
stop ) stop )
#some stop #some stop
;; ;;
deploy ) deploy )
deploy_ppss deploy_ppss
;; cleanup
show ) exit 0
# some show command ;;
;; status )
show_status
# some show command
;;
erase )
erase_ppss
cleanup
exit 0
* ) * )
showusage showusage
exit 1;; exit 1;;
esac esac
} }