Commit 4b066bfd authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Further simplifications

parent b2ebd003
Pipeline #3798087 passed with stages
in 12 minutes and 58 seconds
......@@ -40,8 +40,7 @@ print_usage() {
echo Usage: $0 --dryrun\|--doit username \[xrdlogfile\]
echo ' --dryrun: no copy and no quota changes are executed, but commands are printed on screen'
echo ' username: CASTOR user directory without prefix'
echo ' nbthreads: number of concurrent copy threads, defaults to 20'
echo ' xrdlogfile: xrootd logs file, defaults to /var/log/c2cboxcopy.log'
echo ' xrdlogfile: xrootd logs file, defaults to /var/log/c2cboxcopy_remigrate.log'
exit 1
}
......@@ -68,7 +67,7 @@ xrd3cp() { # args: source, targetname, targetpath, mtime, logiferrors
echo 1 > $xrdcpfail
echo "---" >> $log
echo "Copy failed with rc=${rc}, command and outputs were:" >> $log
echo "xrdcp --cksum adler32 --tpc only "\""root://castorpublic/$1"\"" "\""root://eoshome-$2//eos/user/.castormigration/$3?eos.ruid=${ruid}&eos.rgid=${rgid}&eos.mtime=$4&eos.app=castormig"\" >> $log
echo "xrdcp --cksum adler32 --tpc only "\""root://castorpublic/$1"\"" "\""root://eoshome-${2:0:1}//eos/user/${2:0:1}/$2/$3?eos.ruid=${ruid}&eos.rgid=${rgid}&eos.mtime=$4&eos.app=castormig"\" >> $log
cat $xrdlog >> $log
else
# success, show some progress bar
......@@ -178,7 +177,6 @@ echo `date +%Y-%m-%dT%H:%M:%S`" Migrating $(( totalsize/1000000000 )) GB in ${c
echo "===" >> $log
echo `date +%Y-%m-%dT%H:%M:%S`" Migrating $(( totalsize/1000000000 )) GB in ${count} files for user ${username}..." >> $log
#if [[ "$dryrun" == "--doit" ]]; then
semid=`basename $xrdcpfail` # we just need a random unique string as semaphore id
IFS=
while read line; do
source=`echo $line | cut -c94-`
......@@ -186,9 +184,9 @@ echo `date +%Y-%m-%dT%H:%M:%S`" Migrating $(( totalsize/1000000000 )) GB in ${c
mtime=`echo $line | awk '{print $7}' | cut -d\- -f 1 | xargs`
echo $line | awk '{print $4 "@" $5}' | grep -q '1@0'
nonzerobytes=$?
sem --id $semid --jobs $nthreads xrd3cp \""$source"\" "$targetname" \""${finallocation}${target}"\" "$mtime" "$nonzerobytes"
# check roughly every 100 files
if [[ $RANDOM -lt 300 ]]; then
xrd3cp "$source" "$targetname" "${finallocation}${target}" "$mtime" "$nonzerobytes"
# check roughly every 1000 files
if [[ $RANDOM -lt 30 ]]; then
krbhour=`date +%k`
if [[ $krbhour -eq 0 ]]; then
today=`date +%d`
......@@ -201,7 +199,6 @@ echo `date +%Y-%m-%dT%H:%M:%S`" Migrating $(( totalsize/1000000000 )) GB in ${c
fi
fi
done < onlyfiles_${username}
sem --id $semid --wait
echo >> $log
#fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment