Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add backup script; move all scripts into their own subdir

  • Loading branch information...
commit 69ddab3abc54bb92be36de7bbb35a586efafce79 1 parent 3889b0a
@zsol authored
View
33 scripts/backup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+INSTANCE="$1"
+
+BACKUPDIR=/home/cupapp/Dropbox/backup/$INSTANCE
+
+if [ "x$INSTANCE" = "x" ]; then
+ echo "Specify instance"
+ exit 1
+fi
+
+FILENAME=$(date +%Y-%m-%d)
+if [ -e $BACKUPDIR/$FILENAME ]; then
+ echo $BACKUPDIR/$FILENAME exists
+ exit 2
+fi
+
+USER=$(grep username: $HOME/$INSTANCE/config/databases.yml | sed 's/^.*:\s*\(\S\+\)/\1/')
+PASSWORD=$(grep password: $HOME/$INSTANCE/config/databases.yml | sed 's/^.*:\s*\(\S\+\)/\1/')
+
+BACKUP=$(mktemp -d)
+
+mkdir ${BACKUP}/$FILENAME
+cd $BACKUP
+
+mysqldump -u $USER --password=$PASSWORD --dump-date $INSTANCE > $FILENAME/sql
+cp -a $HOME/$INSTANCE/web/uploads $FILENAME/
+
+tar cjf $BACKUPDIR/$FILENAME.tar.bz2 --preserve-permissions --preserve-order $FILENAME/ 2> /dev/null || echo "ERROR DURING TAR"
+
+cd - > /dev/null
+
+rm -rf $BACKUP
View
0  deploy.sh → scripts/deploy.sh
File renamed without changes
View
38 scripts/sync.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+BASEDIR=${BASEDIR:-$(dirname $(readlink -f $0))}
+BRANCH=${BRANCH:-"master"}
+pushd "$BASEDIR" > /dev/null
+
+function needs_sync_with()
+{
+ if [ "$(git ls-remote --heads $1 $BRANCH)" == "$(git ls-remote --heads ./. $BRANCH)" ]; then
+ return 1
+ fi
+ return 0
+}
+
+function run_cmd()
+{
+ echo Running: \"$@\" ...
+ if eval "$@"; then
+ echo OK
+ else
+ echo "Failed..."
+ exit 1
+ fi
+}
+
+if needs_sync_with "origin" ; then
+ run_cmd git pull --ff-only -- origin $BRANCH
+ run_cmd git submodule update --init
+ run_cmd ./symfony propel:migrate
+ run_cmd ./symfony propel:build-model
+ run_cmd ./symfony propel:build-forms
+ run_cmd ./symfony propel:build-filters
+ run_cmd ./symfony propel:build-sql
+ run_cmd ./symfony cc
+fi
+
+popd > /dev/null
+
View
38 sync.sh
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-BASEDIR=${BASEDIR:-$(dirname $(readlink -f $0))}
-BRANCH=${BRANCH:-"master"}
-pushd "$BASEDIR" > /dev/null
-
-function needs_sync_with()
-{
- if [ "$(git ls-remote --heads $1 $BRANCH)" == "$(git ls-remote --heads ./. $BRANCH)" ]; then
- return 1
- fi
- return 0
-}
-
-function run_cmd()
-{
- echo Running: \"$@\" ...
- if eval "$@"; then
- echo OK
- else
- echo "Failed..."
- exit 1
- fi
-}
-
-if needs_sync_with "origin" ; then
- run_cmd git pull --ff-only -- origin $BRANCH
- run_cmd git submodule update --init
- run_cmd ./symfony propel:migrate
- run_cmd ./symfony propel:build-model
- run_cmd ./symfony propel:build-forms
- run_cmd ./symfony propel:build-filters
- run_cmd ./symfony propel:build-sql
- run_cmd ./symfony cc
-fi
-
-popd > /dev/null
-
View
1  sync.sh
Please sign in to comment.
Something went wrong with that request. Please try again.