#!/bin/bash # # Download all links from a Semantic Scuttle instance. # # Configuration source config || exit 1 # Other parameters BASEDIR=/var/sites/links SCUTTLEDIR=`basename $( find ${BASEDIR} -maxdepth 1 -iname "SemanticScuttle-*" | head -n 1 )` CONFIGFILE=${BASEDIR}/${SCUTTLEDIR}/data/config.php # Load functions source lib/httracker/functions || exit 1 getconf() { grep ${1} ${CONFIGFILE} | sed -e s/\[^\'\]\*\'// -e s/\'\.\*\$// } dbuser=`getconf dbuser` dbpass=`getconf dbpass` dbname=`getconf dbname` dbhost=`getconf dbhost` sqlquery() { mysql --skip-column-names --batch \ --user=${dbuser} \ --password=${dbpass} \ --database=${dbname} \ --host=${dbhost} \ --execute="${1}" } # Grab URLs from db URLS=`mktemp -p ${TMP}` chown links.links ${URLS} chmod 600 ${URLS} sqlquery "select bAddress from sc_bookmarks;" > ${URLS} # Prepare and download httracker_target_single httracker_get_single # Cleanup rm -rf $TMP