diff --git a/script/tools/delete_iso.sh b/script/tools/delete_iso.sh index 83a9c0e535667e9257309a81296e6dc6e6e25758..3396ffcf247c97bd0dd6fad35c7c5e6aee06c9e7 100644 --- a/script/tools/delete_iso.sh +++ b/script/tools/delete_iso.sh @@ -5,7 +5,7 @@ DIR=$1 my_key=$2 ISO_DAYS=$3 TODAY=`date +%s` -files=`ssh -i $my_key -o StrictHostKeyChecking=no root@121.36.84.172 "ls $DIR | grep openeuler-"` +files=`ssh -i $my_key -o StrictHostKeyChecking=no root@121.36.84.172 "ls $DIR | grep ^openeuler-"` for file in $files do diff --git a/script/tools/link_latest_dailybuild.sh b/script/tools/link_latest_dailybuild.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c9eed30b7c97446e27a2e5e33ec4fe4e61d1d13 --- /dev/null +++ b/script/tools/link_latest_dailybuild.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# usage: bash link_latest_dailybuild.sh +echo "--------------- start link to latest dailybuild ----------------" +DIR=$1 +my_key=$2 +ssh_ip=$3 +Project=`echo $DIR | awk -F "/" '{print $NF}'` +files=`ssh -i $my_key -o StrictHostKeyChecking=no root@${ssh_ip} "ls $DIR | grep ^openeuler-"` +num=0 +declare -a date_num +for file in $files +do + echo $file + if [[ $file == openeuler-* ]];then + year=`echo $file | cut -d "-" -f 2` + month=`echo $file | cut -d "-" -f 3` + day=`echo $file | cut -d "-" -f 4` + hour=`echo $file | cut -d "-" -f 5` + min=`echo $file | cut -d "-" -f 6` + sec=`echo $file | cut -d "-" -f 7` + file=`echo $file | sed 's/\r//g'` + echo "$file +++++++" + date=`date -d "$year-$month-$day $hour:$min:$sec" +%s` + date_num[$num]=$date + num=`expr $num + 1` + fi +done + +echo ${date_num[@]} +Max=${date_num[0]} +for I in ${!date_num[@]};do + if [[ ${Max} -le ${date_num[${I}]} ]];then + Max=${date_num[${I}]} + fi +done + +daily_dir="openeuler-`date -d @$Max +%Y-%m-%d-%H-%M-%S`" +echo "latest_dir:$daily_dir" +ssh -i $my_key -o StrictHostKeyChecking=no root@${ssh_ip} "cd $DIR && rm -rf $Project && ln -s $daily_dir $Project" +if [ $? -eq 0 ];then + echo "Success to make soft link" +else + echo "Fail to make soft link" +fi