auto-update map system (start & cron)
This commit is contained in:
parent
1b69946e0a
commit
6b0418dafa
|
@ -16,6 +16,9 @@ echo "add metadata"
|
|||
/usr/local/bin/univnautes-update-metadata.sh
|
||||
/usr/local/bin/univnautes-update-local-metadata.sh
|
||||
|
||||
echo "build map info"
|
||||
/usr/local/bin/univnautes-update-map.sh
|
||||
|
||||
echo "univnautes databases are ready"
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -21,6 +21,8 @@ log() {
|
|||
logger -p local4.info -t update-map -- "$*"
|
||||
}
|
||||
|
||||
log "build login.html with geo locations"
|
||||
|
||||
GEOURLS=/var/lib/univnautes/geourls
|
||||
GEOLOCAL=/var/lib/univnautes/geolocal
|
||||
LOGINHTML=/var/lib/univnautes/templates/login.html
|
||||
|
@ -29,8 +31,16 @@ GEODIR=/var/lib/univnautes/geofiles
|
|||
mkdir -p $GEODIR
|
||||
GEOFILES=""
|
||||
|
||||
# build urls list from file
|
||||
GEOURLS=`cat $GEOURLS | tr -d ^M | xargs`
|
||||
# if file is empty, use default urls (renater federation)
|
||||
if [ -n "$GEOURLS" ]
|
||||
then
|
||||
GEOURLS="https://static.discojuice.org/feeds/renater http://isos.univnautes.entrouvert.com/univnautes.geo"
|
||||
fi
|
||||
|
||||
n=1
|
||||
for url in `cat $GEOURLS | tr -d
`
|
||||
for url in $GEOURLS
|
||||
do
|
||||
GEOFILE=$GEODIR/$n
|
||||
wget -q --no-check-certificate -O $GEOFILE $url
|
||||
|
@ -47,6 +57,7 @@ done
|
|||
if [ -r $GEOLOCAL ]
|
||||
then
|
||||
GEOFILES=$GEOFILES" "$GEOLOCAL
|
||||
log "use local geo locations ($n)"
|
||||
fi
|
||||
|
||||
# virtualenv activation
|
||||
|
@ -60,7 +71,9 @@ cd /usr/local/univnautes/pffedportal
|
|||
if [ -r pffedportal.db ]
|
||||
then
|
||||
python ./create_loginhtml.py $GEOFILES 2>&1 > $LOGINHTML | logger -p local4.info -t update-map
|
||||
log "geo-list of idp created"
|
||||
log "login.html created"
|
||||
else
|
||||
log "pffedportal.db is not ready"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -75,7 +75,7 @@ function univnautes_restart_all() {
|
|||
mwexec_bg("/usr/local/bin/univnautes-update-metadata.sh");
|
||||
mwexec_bg("/usr/local/bin/univnautes-update-local-metadata.sh");
|
||||
mwexec_bg("/usr/local/bin/univnautes-update-whitelist.sh");
|
||||
# FIXME : MAP_UPDATE
|
||||
mwexec_bg("/usr/local/bin/univnautes-update-map.sh");
|
||||
}
|
||||
|
||||
function univnautes_texts_sync() {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
. /usr/local/univnautes/etc/univnautes.conf
|
||||
UPDATER=/usr/local/bin/univnautes-update-metadata.sh
|
||||
MAPUPDATER=/usr/local/bin/univnautes-update-map.sh
|
||||
CLEANUP=/usr/local/bin/univnautes-cleanup.sh
|
||||
|
||||
log() {
|
||||
|
@ -109,12 +110,14 @@ _cronstart() {
|
|||
_cronstop
|
||||
/usr/local/bin/minicron $REFRESH /var/run/update-metadata-cron.pid $UPDATER
|
||||
log "update-metadata cron started (every $REFRESH seconds)"
|
||||
/usr/local/bin/minicron $REFRESH /var/run/update-map-cron.pid $MAPUPDATER
|
||||
log "update-map cron started (every $REFRESH seconds)"
|
||||
/usr/local/bin/minicron $REFRESH /var/run/cleanup-cron.pid $CLEANUP
|
||||
log "cleanup cron started (every $REFRESH seconds)"
|
||||
}
|
||||
|
||||
_cronstop() {
|
||||
for cron in update-metadata cleanup
|
||||
for cron in update-metadata update-map cleanup
|
||||
do
|
||||
if [ -r /var/run/${cron}-cron.pid ]
|
||||
then
|
||||
|
|
Reference in New Issue