Add upgrade, restart-overnight-backups scripts for generic backup app

This commit is contained in:
Lance Edgar 2019-09-30 15:37:21 -05:00
parent 067c02e965
commit 0b5f6234ad
4 changed files with 46 additions and 17 deletions

View file

@ -2,19 +2,16 @@
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
VERBOSE='--verbose'
QUIET=
PROGRESS='--progress'
CONFIG='/srv/envs/${envname}/app/rattail.conf'
else
VERBOSE=
QUIET='--quiet'
PROGRESS=
CONFIG='/srv/envs/${envname}/app/silent.conf'
fi
RATTAIL="/srv/envs/${envname}/bin/rattail --config=$CONFIG $PROGRESS $VERBOSE"
PIP="sudo -H -u ${user} PIP_CONFIG_FILE=/srv/envs/${envname}/pip.conf /srv/envs/${envname}/bin/pip"
# sanity check
if [ "$HOME" != '/root' ]; then
@ -25,18 +22,8 @@ if [ "$HOME" != '/root' ]; then
exit 1
fi
# upgrade pip
$PIP install $QUIET --upgrade pip
# upgrade rattail
cd /srv/envs/${envname}/src/rattail
if [ "$(sudo -H -u ${user} git status --porcelain)" != '' ]; then
sudo -H -u ${user} git status
exit 1
fi
sudo -H -u ${user} git pull $QUIET
find . -name '*.pyc' -delete
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
# upgrade app
/srv/envs/${envname}/app/upgrade.sh $VERBOSE
# run backup
cd /srv/envs/${envname}

View file

@ -0,0 +1,5 @@
#!/bin/sh -e
DATE=`date --date='yesterday' +%Y-%m-%d`
echo "${envpath}/bin/rattail -c ${envpath}/app/silent.conf --no-versioning run-n-mail -S 'Backups (continued)' '${envpath}/app/overnight-backups.sh $DATE'" | at 'now + 1 minute'

View file

@ -0,0 +1,25 @@
#!/bin/sh -e
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
VERBOSE='--verbose'
QUIET=
else
VERBOSE=
QUIET='--quiet'
fi
PIP="sudo -H -u ${user} PIP_CONFIG_FILE=${envpath}/pip.conf ${envpath}/bin/pip"
# upgrade pip
$PIP install $QUIET --upgrade pip
# upgrade rattail
cd ${envpath}/src/rattail
if [ "$(sudo -H -u ${user} git status --porcelain)" != '' ]; then
sudo -H -u ${user} git status
exit 1
fi
sudo -H -u ${user} git pull $QUIET
find . -name '*.pyc' -delete
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .