#!/bin/bash
importfile=$1
sleepyperiod=$2
U=$3
PW=$4
HOST=$5
PORT=$6
function usage {
echo "$0 <import file> <sleepy period> <user> <password> <host> <:port>"
}
function pollStatus {
sp=$1
status=`curl -s -G "http://${U}:${PW}@${HOST}${PORT}/alfresco/service/bulk/import/filesystem/status.json"`
rv=0
inprogress=`echo $status | grep "inProgress" | cut -d":" -f2`
if [ "$inprogress" == ' true, "status" ' ]; then
rv=0
echo -n "."
sleep $sp
else
rv=1
fi
return $rv
}
function ingestSite {
src="$1"
target="$2"
sp=$3
sowhat=`curl -s -G "http://${U}:${PW}@${HOST}${PORT}/alfresco/s/bulk/import/filesystem/initiate?targetPath=$target&sourceDirectory=$src"`
rv=$?
return $rv
}
function ingestFile {
in=$1
sp=$2
while read line
do
src=`echo $line | cut -f1 -d","`
target=`echo $line | cut -f2 -d","`
src="${src/ /%20}"
target="${target/ /%20}"
ingestSite "$src" "$target" $sp
rv=$?
if [ $rv -eq 0 ]; then
echo "Ingesting $src to $target"
rv2=0
while [ $rv2 -eq 0 ]; do
pollStatus $sp
rv2=$?
done
fi
done < $in
}
if [ $# -ne 6 ]; then
usage
exit 1
fi
if [ -e "$importfile" ]; then
ingestFile $importfile $sleepyperiod
else
echo "Cannot locate import file"
usage
fi
--
You received this message because you are subscribed to the Google Groups "Alfresco Bulk Filesystem Import" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-bulk-filesys...@googlegroups.com.
To post to this group, send email to alfresco-bulk-f...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-bulk-filesystem-import.
For more options, visit https://groups.google.com/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-bulk-filesystem-import+unsubscribe@googlegroups.com.
To post to this group, send email to alfresco-bulk-filesystem-imp...@googlegroups.com.