Skip to content

Instantly share code, notes, and snippets.

@enoch85
Last active January 31, 2016 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enoch85/c683de8ef534bdd81946 to your computer and use it in GitHub Desktop.
Save enoch85/c683de8ef534bdd81946 to your computer and use it in GitHub Desktop.
#!/bin/bash
TODAY=`date +"%Y%m%d"`
OLD=`date -d "1 days ago" +"%Y%m%d"`
OLD2=`date -d "10 days ago" +"%Y%m%d"`
USER=enoch
UPLOAD_DIR="/var/www/owncloud/data/$USER/files/Projekt/GITHUB_MAIL"
# Clone Mail master
git clone https://github.com/owncloud/mail.git
# Install PHP/JS Dependencies
cd mail
make
cd ..
# Move .zip archive to the shared folder in ownCloud
mv mail/build/artifacts/appstore/mail.tar.gz $UPLOAD_DIR/owncloud_mail_nightly_build_$TODAY.tar.gz
# Cleanup
rm -rf mail
mv $UPLOAD_DIR/owncloud_mail_nightly_build_$OLD.tar.gz $UPLOAD_DIR/OLD_NIGHTLIES/owncloud_mail_nightly_build_$OLD.tar.gz
rm $UPLOAD_DIR/OLD_NIGHTLIES/owncloud_mail_nightly_build_$OLD2.tar.gz
# Set correct permissions to zip file
bash /var/scripts/setup_secure_permissions_owncloud.sh
# Rescan files with .occ
sudo -u www-data php /var/www/owncloud/occ files:scan -p $USER/files/Projekt/GITHUB_MAIL/
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment