ExtensionCrawler/sge/create-db.sh

34 lines
1002 B
Bash
Raw Normal View History

2017-08-23 17:04:33 +00:00
#!/usr/bin/bash
set -o nounset
2017-08-23 22:23:21 +00:00
set -o errexit
2017-09-02 16:05:42 +00:00
NRJOBS=${NRJOBS:-256}
echo "Using $NRJOBS jobs"
ARCHIVE=${ARCHIVE:-$(ssh sharc.shef.ac.uk find /shared/brucker_research1/Shared/BrowserExtensions/.snapshot -maxdepth 1 -name \"D*\" | sort -r | head -n1)}
echo "Using archive: $ARCHIVE"
TARGETDIR="${TARGETDIR:-/data/\$USER}/create-db-$(date +%Y%m%d-%H%M%S)"
echo "Using target dir: $TARGETDIR"
2017-08-23 17:04:33 +00:00
BASEDIR=$( cd $(dirname "$0"); cd ..; pwd -P )
echo "Creating dirs ..."
2017-08-23 22:23:21 +00:00
ssh sharc.shef.ac.uk mkdir -p $TARGETDIR/ExtensionCrawler
ssh sharc.shef.ac.uk mkdir -p $TARGETDIR/logs
2017-08-23 17:04:33 +00:00
2017-08-23 22:23:21 +00:00
echo "Pushing $BASEDIR to sharc.shef.ac.uk:$TARGETDIR/ExtensionCrawler ..."
rsync -zr --exclude "$BASEDIR/archive" "$BASEDIR/" sharc.shef.ac.uk:"$TARGETDIR/ExtensionCrawler"
2017-08-23 17:04:33 +00:00
echo "Starting job ..."
2017-08-23 22:23:21 +00:00
ssh sharc.shef.ac.uk \
ARCHIVE=\"$ARCHIVE\" \
BASEDIR=\"$TARGETDIR\" \
2017-09-02 16:05:42 +00:00
MAX_SGE_TASK_ID=\"$NRJOBS\" \
2017-08-23 22:23:21 +00:00
qsub \
-V \
2017-09-02 16:05:42 +00:00
-t 1-$NRJOBS \
2017-08-23 17:04:33 +00:00
-j yes \
-o "$TARGETDIR/logs" \
2017-09-02 16:45:12 +00:00
"$TARGETDIR/ExtensionCrawler/sge/create-db.sge" \
$@