Skip to content
Snippets Groups Projects
Commit ef792c97 authored by Vineet Reddy Rajula's avatar Vineet Reddy Rajula
Browse files

Add scripts for updb & modify database backup scripts

parent 494acc84
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
set -exu
# Change working directory to the drupal code
cd /app
# Check updb status
drush updatedb-status --format=json
#!/bin/bash
set -exu
usage() {
echo "Usage: $0 --filename <filename.sql>" 1>&2;
exit 1;
}
# Options
ARGS=$(getopt -o 'f:' --long 'filename:' -- "$@") || exit 1
eval "set -- $ARGS"
while true; do
case "$1" in
(-f|--filename)
export FILENAME="$2"; shift 2;;
(--) shift; break;;
(*) usage;;
esac
done
[[ -z "$FILENAME" ]] && usage
# Change working directory to the drupal code
cd /app
# Database backup
echo "Database backup"
drush sql-dump > /drupal-data/dbdump.sql
drush sql-dump > /drupal-data/$FILENAME
#!/bin/bash
set -exu
usage() {
echo "Usage: $0 --filename <filename.sql>" 1>&2;
exit 1;
}
# Options
ARGS=$(getopt -o 'f:' --long 'filename:' -- "$@") || exit 1
eval "set -- $ARGS"
while true; do
case "$1" in
(-f|--filename)
export FILENAME="$2"; shift 2;;
(--) shift; break;;
(*) usage;;
esac
done
[[ -z "$FILENAME" ]] && usage
# Change working directory to the drupal code
cd /app
# Database drop
echo "Database drop"
echo "Dropping database"
drush sql-drop -y
# Database restore
echo "Database restore"
`drush sql-connect` < /drupal-data/dbdump.sql
echo "Database restored"
`drush sql-connect` < /drupal-data/$FILENAME
#!/bin/bash
set -exu
# Change working directory to the drupal code
cd /app
# Run update db
echo "Running drush updatedb"
drush updatedb -y
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment