DevelopmentServer: wiki-live2dev

File wiki-live2dev, 842 bytes (added by chris, 6 years ago)
Line 
1#!/bin/bash
2
3# Make sure only root can run our script
4if [ "$(id -u)" != "0" ]; then
5   echo "This script must be run as root" 1>&2
6   exit 1
7fi
8if [[ $HOME != "/root" ]]; then
9   echo "This script must be run as root user not via sudo"  1>&2
10   exit 1
11fi
12
13printf "Have you run /usr/local/bin/backup2kiwi on quince.webarch.net? (y): "
14read REMOTE_SCRIPT_RUN
15if [[ "$REMOTE_SCRIPT_RUN" = "y" ]]; then
16
17  # copy files across
18  rsync -av /home/live/quince/web/wiki.transitionnetwork.org/www/images/ /web/wiki.dev.transitionnetwork.org/www/images/
19
20  # update database
21  cd /home/live/quince/var/backups/mysql/
22  LATEST_MYSQL_DUMP=`ls -t1 *.gz | head -n1`
23  tar -zxvf $LATEST_MYSQL_DUMP
24  LATEST_MYSQL_DUMP_DIR=`echo $LATEST_MYSQL_DUMP | sed -e s/_.tar.gz//`
25  cd $LATEST_MYSQL_DUMP_DIR
26  cat *transwiki* | mysql transwiki 
27
28else
29  exit 1
30fi
31
32
33