Backup, this version is broken.

This commit is contained in:
Louwrentius 2010-07-14 21:06:11 +00:00
parent 5614724162
commit 211bd40641

95
ppss
View File

@ -84,6 +84,7 @@ START_PPSS=""
STOP_PPSS="" STOP_PPSS=""
SIZE_OF_INPUT="" SIZE_OF_INPUT=""
LOCAL_LOCKING="1" LOCAL_LOCKING="1"
PROCESSED_ITEMS=""
SSH_SERVER="" # Remote server or 'master'. SSH_SERVER="" # Remote server or 'master'.
SSH_KEY="" # SSH key for ssh account. SSH_KEY="" # SSH key for ssh account.
@ -1062,7 +1063,6 @@ stack_push () {
fi fi
} }
stack_pop () { stack_pop () {
TMP_STACK="" TMP_STACK=""
i=0 i=0
@ -1567,6 +1567,80 @@ release_input_lock () {
fi fi
} }
list_all_input_items () {
for x in `cat $LISTOFITEMS`
do
echo "$x"
done
}
return_difference_between_vars () {
VAR_A="$1"
VAR_B="$2"
for x in $VAR_A
do
FILE_IS_IN_VAR_B=0
for y in $VAR_B
do
TMP=`echo "$x" | $MD5 | awk '{ print $1 }'`
if [ "$y" = "$TMP" ]
then
FILE_IS_PROCESSED=1
fi
done
if [ "$FILE_IS_IN_VAR_B" = "0" ]
then
echo "$x"
else
log DEBUG "Value $x occurs in 'var b'"
fi
done
}
remove_processed_items_from_input_file () {
#
# This function removes all items that have already been processed.
# Processed items have a lock dir in the PPPSS_ITEM_LOCK_DIR.
#
INPUTFILES=`list_all_input_items`
RES=`exec_cmd "ls -1 $ITEM_LOCK_DIR"`
rm "$LISTOFITEMS"
for x in $INPUTFILES
do
FILE_IS_PROCESSED=0
for y in $RES
do
TMP=`echo "$x" | $MD5 | awk '{ print $1 }'`
if [ "$y" = "$TMP" ]
then
FILE_IS_PROCESSED=1
fi
done
if [ "$FILE_IS_PROCESSED" = "0" ]
then
echo "$x" >> "$LISTOFITEMS"
else
log DEBUG "ITEM $x is already processed!"
fi
done
}
get_list_of_new_items () {
}
get_all_items () { get_all_items () {
if [ "$DAEMON" == "1" ] if [ "$DAEMON" == "1" ]
@ -1574,7 +1648,7 @@ get_all_items () {
get_input_lock get_input_lock
fi fi
if [ -e "$LISTOFITEMS" ] && are_we_sourced if [ -e "$LISTOFITEMS" ]
then then
rm "$LISTOFITEMS" rm "$LISTOFITEMS"
fi fi
@ -1594,6 +1668,9 @@ get_all_items () {
`exec_cmd "find $SRC_DIR/ -d 1 ! -type d" > "$LISTOFITEMS"` `exec_cmd "find $SRC_DIR/ -d 1 ! -type d" > "$LISTOFITEMS"`
check_status "$?" "$FUNCNAME" "Could not list files within remote source directory." check_status "$?" "$FUNCNAME" "Could not list files within remote source directory."
fi fi
remove_processed_items_from_input_file
else else
if [ -e "$SRC_DIR" ] if [ -e "$SRC_DIR" ]
then then
@ -2165,33 +2242,35 @@ listen_for_job () {
PIDS="" PIDS=""
log DEBUG "Listener started." log DEBUG "Listener started."
if [ "$DAEMON" = "1" ] && [ "$INOTIFY" = "1" ] if [ "$DAEMON" = "1" ]
then
if [ "$INOTIFY" = "1" ]
then then
log INFO "Linux inotify enabled." log INFO "Linux inotify enabled."
start_inotify_listener start_inotify_listener
else
log INFO "Linux inotify disabled."
fi
fi fi
while read event <& 42 while read event <& 42
do do
if [ "$event" = "$START_KEY" ] if [ "$event" = "$START_KEY" ]
then then
log DEBUG "Got a 'start-key' event"
if get_item if get_item
then then
run_command "$ITEM" run_command "$ITEM"
else else
((ACTIVE_WORKERS--)) ((ACTIVE_WORKERS--))
if [ "$ACTIVE_WORKERS" -le "0" ]
then
if [ "$DAEMON" == "1" ] && [ "$INOTIFY" = "0" ] if [ "$DAEMON" == "1" ] && [ "$INOTIFY" = "0" ]
then then
start_as_daemon start_as_daemon
else else
break break
fi fi
else
display_jobs_remaining display_jobs_remaining
fi fi
fi
elif [ "$event" == "$STOP_KEY" ] elif [ "$event" == "$STOP_KEY" ]
then then
((ACTIVE_WORKERS--)) ((ACTIVE_WORKERS--))
@ -2353,6 +2432,8 @@ main () {
for NODE in `cat $NODES_FILE` for NODE in `cat $NODES_FILE`
do do
start_ppss_on_node "$NODE" start_ppss_on_node "$NODE"
echo "REMOVE THIS DEBUGGING CODE"
sleep 5
done done
fi fi
cleanup cleanup