summaryrefslogtreecommitdiff
path: root/cron-jobs/update-web-db
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 23:25:11 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 23:25:11 -0400
commit63381988ae8a0f4e0c8eaede88b43a5f685ec80f (patch)
treed11a514227114a3014633b3b649accb20bfe14ac /cron-jobs/update-web-db
parentc52b1fa175b0bcc1bd2ec86ca7f4a926905dce0b (diff)
remove more scripts that I know to be obsolete
Diffstat (limited to 'cron-jobs/update-web-db')
-rwxr-xr-xcron-jobs/update-web-db78
1 files changed, 0 insertions, 78 deletions
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
deleted file mode 100755
index 713e75e..0000000
--- a/cron-jobs/update-web-db
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-
-. "$(dirname "$(readlink -e "$0")")/../config"
-. "$(dirname "$(readlink -e "$0")")/../db-functions"
-
-# setup paths
-SPATH="/srv/http/archweb"
-ENVPATH="/srv/http/archweb-env/bin/activate"
-
-# having "more important repos" last should make [core] trickle to the top of
-# the updates list each hour rather than being overwhelmed by big [extra] and
-# [community] updates
-REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 'testing' 'core')
-LOGOUT="/tmp/archweb_update.log"
-
-# figure out what operation to perform
-cmd="${0##*/}"
-if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then
- die "Invalid command name '$cmd' specified!"
-fi
-
-script_lock
-
-# run at nice 5. it can churn quite a bit of cpu after all.
-renice +5 -p $$ > /dev/null
-
-echo "$cmd: Updating DB at $(date)" >> "${LOGOUT}"
-
-# source our virtualenv if it exists
-if [ -f "$ENVPATH" ]; then
- . "$ENVPATH"
-fi
-
-case "$cmd" in
- update-web-db)
- dbfileext="${DBEXT}"
- flags=""
- ;;
- update-web-files-db)
- dbfileext="${FILESEXT}"
- flags="--filesonly"
- ;;
-esac
-
-# Lock the repos and get a copy of the db files to work on
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
- repo_lock ${repo} ${arch} || exit 1
- dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}"
- if [ -f "${dbfile}" ]; then
- mkdir -p "${WORKDIR}/${repo}/${arch}"
- cp "${dbfile}" "${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
- fi
- repo_unlock ${repo} ${arch}
- done
-done
-
-# Run reporead on our db copy
-pushd $SPATH >/dev/null
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
- dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
- if [ -f "${dbcopy}" ]; then
- echo "Updating ${repo}-${arch}" >> "${LOGOUT}"
- ./manage.py reporead ${flags} ${arch} "${dbcopy}" >> "${LOGOUT}" 2>&1
- echo "" >> "${LOGOUT}"
- fi
- done
-done
-popd >/dev/null
-echo "" >> "${LOGOUT}"
-
-# rotate the file if it is getting big (> 10M), overwriting any old backup
-if [[ $(stat -c%s "${LOGOUT}") -gt 10485760 ]]; then
- mv "${LOGOUT}" "${LOGOUT}.old"
-fi
-
-script_unlock