Skip to content

Instantly share code, notes, and snippets.

@mtyeh411
Created July 30, 2013 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtyeh411/6117098 to your computer and use it in GitHub Desktop.
Save mtyeh411/6117098 to your computer and use it in GitHub Desktop.
cron this for sane Semantic MediaWiki data refreshes
#!/usr/bin/env bash
PIDDIR="/var/run/wiki"
mkdir -p $PIDDIR
PIDFILE="$PIDDIR/SMW_refreshData.pid"
SMW_DIR="/ebs/var/www/html/w/extensions/SemanticMediaWiki"
LOG_DIR="/var/log/wiki"
REFRESH_RATE=20
if [ -e "${PIDFILE}" ] && (ps -u $USER -f | grep "[ ]$(cat ${PIDFILE})[ ]"); then
echo "Already running."
exit 99
fi
php $SMW_DIR/maintenance/SMW_refreshData.php -n $REFRESH_RATE -v --startidfile $LOG_DIR/refresh.log >> $LOG_DIR/SMW_refreshData.log &
echo $! > "${PIDFILE}"
chmod 644 "${PIDFILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment