[server-admins] Updated yum-update-and-wiki-update.sh script
Jonathan Marsden
jmarsden at fastmail.fm
Fri Aug 21 21:35:33 MST 2009
Per Troy's request and a little IRC discussion, here is an enhanced
yum-update-and-wiki-update.sh script that only does the wiki-specific
stuff if it needs to.
Jonathan
#!/bin/bash
# yum-update-and-wiki-update.sh
# Runs yum update, backing up and updating mediawiki if needed.
# Optional parameter is backup directory.
#
# Author: Jonathan Marsden <jmarsden at fastmail.fm>
# Date: 2009-08-21
#
# Global config variables
DEFAULTBACKUPDIR="/usr/local/backup/mediawiki" # Default location
BACKUPDIR=${1:-"$DEFAULTBACKUPDIR"}
WIKIDIR="/usr/share/mediawiki"
WIKIUPDATER="maintenance/update.php"
MWUPDATE="no" # Is a mediawiki update pending? Default to no.
# Is a mediawiki update really pending?
grep -sq ^mediawiki <( yum check-update ) && MWUPDATE="yes"
# Backup the wiki if necessary
[ "$MWUPDATE" = "yes" ] && backup-wiki.sh "$BACKUPDIR"
# Run yum update
sudo yum update -y
# Run the PHP script to update the wiki database, if necessary
[ "$MWUPDATE" = "yes" ] && cd "$WIKIDIR" && php $WIKIUPDATER
More information about the server-admins
mailing list