Commit f9126e94 authored by Sergio Bruni's avatar Sergio Bruni
Browse files

added manage_dirs_permissions.sh

parent 7a3f68b2
#!/bin/bash
while getopts n:y: option
do
case "${option}"
in
n) net_or_all=${OPTARG};;
y) year_or_all=${OPTARG};;
esac
done
if ! [ -n "${net_or_all+set}" ]; then
echo 'insert network name or all'; exit 1
fi
if ! [ -n "${year_or_all+set}" ]; then
echo 'insert year YYYY or all'; exit 1
fi
shopt -s nocasematch
re="^(all|[0-9]{4}+)$"
if ! [[ $year_or_all =~ $re ]] ; then
echo "insert year in four digit form or all"; exit 1
fi
net_or_all=${net_or_all^^}
year_or_all=${year_or_all^^}
in_root="/mnt/data/archive/rinex/CGPS/NETS"
net_array=()
if [[ $net_or_all == 'ALL' ]]
then
for my_net in $(ls -t ${in_root}*/ | sort) ; do
net_array+=($my_net)
done
else
net_array+=($net_or_all)
fi
re_anno='^[0-9]{4}+$'
for net in "${net_array[@]}"
do
# se richieste tutte le reti salto la RING
# cosa temporanea
if [ $net_or_all == 'ALL' ] && [ $net == "RING" ] ; then
echo "SKIP RING"
continue
fi
year_array=()
if [[ $year_or_all == 'ALL' ]]; then
for my_year in $(ls -t ${in_root}/${net}*/ | sort) ; do
if [[ $my_year =~ $re_anno ]] ; then
# se richiesti tutti gli anni per ora salto 2015/16/17
if [ ${my_year} -ne '2015' ] && [ $my_year -ne '2016' ] && [ $my_year -ne '2017' ] && [ $my_year -ne '2018' ] && [ $my_year -ne '2019' ] ; then
year_array+=($my_year)
else
echo "SKIP ${my_year}"
fi
fi
done
else
# e' stato chiesto un solo anno
if [ -d ${in_root}/${net}/${year_or_all} ] ; then
year_array+=($year_or_all)
else
echo "folder ${in_root}/${net}/${year_or_all} do not exists"
continue
fi
fi
for year in "${year_array[@]}" ; do
echo "./populateLog.py -e excluded_${net}_${year} -n $net -y $year -H gnssgiving.int.ingv.it -U sergio -P p0wer2017 -a -r /mnt/data/archive/rinex/CGPS/NETS"
./populateLog.py -e excluded_${net}_${year} -n "$net" -y "$year" -H gnssgiving.int.ingv.it -U sergio -P p0wer2017 -a -r /mnt/data/archive/rinex/CGPS/NETS
done
done
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