diff options
author | Dan McGee <dan@archlinux.org> | 2010-02-27 17:47:52 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-02-27 18:33:30 +0100 |
commit | 1d6421c7a12e9a07d00ec4de999ae95f7dd0874e (patch) | |
tree | c694af2133c5185066198d12270bf33586a7d7e5 /cron-jobs | |
parent | ba7968503f18e5a2537d7d87ce2a5caa582f04f7 (diff) | |
download | dbscripts-1d6421c7a12e9a07d00ec4de999ae95f7dd0874e.tar.gz dbscripts-1d6421c7a12e9a07d00ec4de999ae95f7dd0874e.tar.xz |
create-filelists: general cleanups
* Specify lock name once
* Use new script name everywhere
* Clean up tabs/spaces and add a modeline. This isn't necessarily the one we
wanted to standardize on, but I picked the one the entire file is written
to at the moment.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'cron-jobs')
-rwxr-xr-x | cron-jobs/create-filelists | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cron-jobs/create-filelists b/cron-jobs/create-filelists index c9d7db9..e90da00 100755 --- a/cron-jobs/create-filelists +++ b/cron-jobs/create-filelists @@ -3,27 +3,28 @@ reposdir="/srv/ftp" targetdir="/srv/ftp" repos="core extra testing community community-testing" +lock="/tmp/create-filelists.lock" . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" -if [ -f "/tmp/createFileList.lock" ]; then - echo "Error: createFileList allready in progress." +if [ -f "$lock" ]; then + echo "Error: create-filelists already in progress." exit 1 fi -touch "/tmp/createFileList.lock" || exit 1 -TMPDIR="$(mktemp -d /tmp/createFileList.XXXXXX)" || exit 1 -CACHEDIR="$(mktemp -d /tmp/createFileList.XXXXXX)" || exit 1 +touch "$lock" || exit 1 +TMPDIR="$(mktemp -d /tmp/create-filelists.XXXXXX)" || exit 1 +CACHEDIR="$(mktemp -d /tmp/create-filelists.XXXXXX)" || exit 1 #adjust the nice level to run at a lower priority /usr/bin/renice +10 -p $$ > /dev/null case "${DBEXT}" in - *.gz) TAR_OPT="z" ;; - *.bz2) TAR_OPT="j" ;; - *.xz) TAR_OPT="J" ;; - *) echo "Unknown compression type for DBEXT=${DBEXT}" && exit 1 ;; + *.gz) TAR_OPT="z" ;; + *.bz2) TAR_OPT="j" ;; + *.xz) TAR_OPT="J" ;; + *) echo "Unknown compression type for DBEXT=${DBEXT}" && exit 1 ;; esac FILESEXT="${DBEXT//db/files}" @@ -77,5 +78,7 @@ done cd - >/dev/null rm -rf "$TMPDIR" || exit 1 rm -rf "$CACHEDIR" || exit 1 -rm -f "/tmp/createFileList.lock" || exit 1 +rm -f "$lock" || exit 1 # echo 'done' + +# vim: set ts=4 sw=4 et ft=sh: |