Created
July 30, 2013 21:21
-
-
Save mtyeh411/6117098 to your computer and use it in GitHub Desktop.
cron this for sane Semantic MediaWiki data refreshes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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