You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
59 lines
1.2 KiB
#!/bin/bash
|
|
|
|
VDN_PATH=$(readlink -f $(dirname $0)/..); . $VDN_PATH/bin/functions.sh
|
|
|
|
synopsis() {
|
|
cat << EOF
|
|
Usage : `basename $0` [-h]
|
|
EOF
|
|
}
|
|
|
|
help() {
|
|
cat << EOF
|
|
|
|
`basename $0` reconstruit la base de données de l'allocateur de ressources.
|
|
|
|
`synopsis`
|
|
|
|
A faire à chaque changement de la liste des utilisateurs,
|
|
ou chaque ajout/suppression d'un réseau ou d'un hôte dans un réseau.
|
|
|
|
EOF
|
|
}
|
|
|
|
usage() {
|
|
synopsis
|
|
exit 1
|
|
}
|
|
|
|
args() {
|
|
local opt
|
|
while getopts "hqs" opt; do
|
|
case $opt in
|
|
h) help; exit 0;;
|
|
?) usage;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
# main
|
|
|
|
args "$@"
|
|
|
|
dir=$VDN_PATH/allocators/db-$VDN_RESOURCES_ALLOCATOR
|
|
|
|
[ ! -d $dir ] && mkdir -p $dir
|
|
|
|
ls $(dirname $HOME) > $dir/users
|
|
|
|
( cd $VDN_NETWORKS_BASE_DIR; find . -maxdepth 1 -type d | grep -v '^\.$' | cut -d '/' -f 2 | grep -v '\/') > $dir/networks
|
|
|
|
rm -f $dir/hosts.global
|
|
for i in $(cat $dir/networks) ; do
|
|
for j in $(cd $VDN_NETWORKS_BASE_DIR/$i; find . -maxdepth 1 -type f -name '*.conf' | sed -re 's/^..(.*).conf$/\1/' ); do
|
|
egrep -q '^NETWORKS=.*(NET_G|NET_0)' $VDN_NETWORKS_BASE_DIR/$i/$j.conf && echo $i:$j >> $dir/hosts.global
|
|
echo $i:$j
|
|
done
|
|
done > $dir/hosts
|
|
|