Skip to content

Apache Lucene open-source search software

SOLR-669 snappuler fix for FreeBSD/Darwin

Otis Gospodneticfacb2db8f3bf
diff --git a/CHANGES.txt b/CHANGES.txt
index 23516d68ea9..16cccfbc3eb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -526,6 +526,8 @@ Bug Fixes
46. SOLR-696: Fixed bug in NamedListCodec in regards to serializing Iterable objects. (gsingers)
+47. SOLR-669: snappuler fix for FreeBSD/Darwin (Richard "Trey" Hyde via Otis Gospodnetic)
+
Other Changes
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
build scripts to make two jars: apache-solr-1.3.jar and
diff --git a/src/scripts/snappuller b/src/scripts/snappuller
index fd081ca31f4..14b75679142 100755
--- a/src/scripts/snappuller
+++ b/src/scripts/snappuller
@@ -224,8 +224,14 @@ ssh -o StrictHostKeyChecking=no ${master_host} mkdir -p ${master_status_dir}
# start new distribution stats
rsyncStart=`date +'%Y-%m-%d %H:%M:%S'`
+if [[ "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]
+then
+ startTimestamp=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncStart" +'%Y%m%d-%H%M%S'`
+ rsyncStartSec=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncStart" +'%s'`
+else
startTimestamp=`date -d "$rsyncStart" +'%Y%m%d-%H%M%S'`
rsyncStartSec=`date -d "$rsyncStart" +'%s'`
+fi
startStatus="rsync of `basename ${name}` started:$startTimestamp"
echo ${startStatus} > ${solr_root}/logs/snappuller.status
pushStatus
@@ -236,8 +242,14 @@ ${stats} rsync://${master_host}:${rsyncd_port}/solr/${name}/ ${data_dir}/${name}
rc=$?
rsyncEnd=`date +'%Y-%m-%d %H:%M:%S'`
+if [[ "${OS}" == "Darwin" || "${OS}" == "FreeBSD" ]]
+then
+ endTimestamp=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncEnd" +'%Y%m%d-%H%M%S'`
+ rsyncEndSec=`date -j -f '%Y-%m-%d %H:%M:%S' "$rsyncEnd" +'%s'`
+else
endTimestamp=`date -d "$rsyncEnd" +'%Y%m%d-%H%M%S'`
rsyncEndSec=`date -d "$rsyncEnd" +'%s'`
+fi
elapsed=`expr $rsyncEndSec - $rsyncStartSec`
if [[ $rc != 0 ]]
then