sync-to-prod.sh 493 Bytes
Newer Older
Louis Abel's avatar
Louis Abel committed
1
2
#!/bin/bash
# Syncs everything from staging to production
3
4

# Source common variables
Louis Abel's avatar
Louis Abel committed
5
source "./common"
6
7
8
9

REV=${1}

cd "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
Louis Abel's avatar
Louis Abel committed
10
ret_val=$?
11

Louis Abel's avatar
Louis Abel committed
12
if [ $ret_val -eq "0" ]; then
13
14
15
16
  TARGET="${PRODUCTION_ROOT}/${CATEGORY_STUB}/${REV:0:3}"
  mkdir -p "${TARGET}"
  sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \
      {} ${TARGET}
Louis Abel's avatar
Louis Abel committed
17
18
19
else
  echo "Failed to change directory"
fi