summaryrefslogtreecommitdiff
path: root/bin/swift-recon-cron
diff options
context:
space:
mode:
authorFlorian Hines <florian.hines@gmail.com>2011-07-27 22:29:23 -0500
committerFlorian Hines <florian.hines@gmail.com>2011-07-27 22:29:23 -0500
commit749892338bfb171eba0c8d10fa905f0e68ed8ca2 (patch)
tree62f257337606847168ed71715253bfd1e32ab8a7 /bin/swift-recon-cron
parentaa622eb799556fd8a7c96d9c431b7037eaf439d0 (diff)
downloadswift-749892338bfb171eba0c8d10fa905f0e68ed8ca2.tar.gz
few fixes to temp cronjob
Diffstat (limited to 'bin/swift-recon-cron')
-rwxr-xr-xbin/swift-recon-cron20
1 files changed, 15 insertions, 5 deletions
diff --git a/bin/swift-recon-cron b/bin/swift-recon-cron
index a8d1c0535..3e4d3928c 100755
--- a/bin/swift-recon-cron
+++ b/bin/swift-recon-cron
@@ -6,19 +6,20 @@
# of high async pendings when the find takes a while.
#todo: everything.
-SYSLOG_FACILITY="local0.error"
+SYSLOG_FACILITY="local2"
ASYNC_PATH="/srv/node/sd[a-z]/async_pending/"
-RECON_CACHE_PATH="/var/cache/swift/object.recon"
+RECON_CACHE_PATH="/var/cache/swift"
LOCKFILE="/var/lock/swift-recon-object.lock"
if [ -e $LOCKFILE ]; then
echo "NOTICE - $0 lock present - cron jobs overlapping ?"
- echo "$0 lock file present" | /usr/bin/logger -p $SYSLOG_FACILITY
+ echo "$0 lock file present" | /usr/bin/logger -p $SYSLOG_FACILITY.err
exit 1
else
touch $LOCKFILE
fi
+
if [ -z "$1" ]; then
LOGFILE="/var/log/swift/storage.log"
else
@@ -26,11 +27,15 @@ else
fi
if [ ! -r "$LOGFILE" ]; then
- echo "$0: error $LOGFILE not readable" | /usr/bin/logger -p $SYSLOG_FACILITY
+ echo "$0: error $LOGFILE not readable" | /usr/bin/logger -p $SYSLOG_FACILITY.err
rm $LOCKFILE
exit 1
fi
+if [ ! -d "$RECON_CACHE_PATH" ]; then
+ mkdir $RECON_CACHE_PATH
+fi
+
TMPF=`/bin/mktemp`
asyncs=$(find $ASYNC_PATH -type f 2> /dev/null| wc -l)
@@ -41,6 +46,11 @@ objincoming=$(netstat -aln | egrep "tcp.*:6000.*:.*ESTABLISHED" -c)
echo "{\"async_pending\":$asyncs, \"object_replication_time\":$objrep, \"object_established_conns\":$objincoming}" > $TMPF
-mv $TMPF $RECON_CACHE_PATH
+mv $TMPF $RECON_CACHE_PATH/object.recon
+if [ $? -ne 0 ]; then
+ echo "$0: $TMPF rename failed" | /usr/bin/logger -p $SYSLOG_FACILITY.err
+ rm -f $TMPF $LOCKFILE
+ exit 1
+fi
rm -f $TMPF $LOCKFILE
exit 0