Difference between revisions of "Tutorial: PhpRunner 9.8 and Photo Display"

From dftwiki3
Jump to: navigation, search
Line 331: Line 331:
 
*  
 
*  
  
 +
==Cron Script to Backup S2 Photos directory+MySql to S3==
 
<br />
 
<br />
 +
::<source lang="bash">
 +
#! /bin/bash
 +
# ~/bin/backupNohoSkies.sh
 +
# D. Thiebaut
 +
# --------------------------------------------------------------------------------
 +
 +
# --------------------------------------------------------------------------------
 +
# BACKUP MYSQL
 +
# --------------------------------------------------------------------------------
 +
#
 +
echo mysqldump
 +
mysqldump --user=nohoSkies --password=voidm%20 NohoSkies > /home/ubuntu/backups/NohoSkies/NohoSkies.sql
 +
# 2> /dev/null
 +
# copy to S3
 +
cd /home/ubuntu/backups/NohoSkies
 +
gzip -f NohoSkies.sql
 +
echo uploading sql file to S3
 +
s3cmd  put  NohoSkies.sql.gz  s3://backup-dft-hadoop02/NohoSkies/
 +
 +
# --------------------------------------------------------------------------------
 +
# BACKUP PHP FILES (ON SUNDAYS ONLY)
 +
# --------------------------------------------------------------------------------
 +
cd /data/html/photos/
 +
_DATE="$(LC_ALL=C date +%A)"
 +
if test "$_DATE" = "Sunday"
 +
then
 +
  echo tar-zipping php files
 +
  tar --exclude='./files' -czf /home/ubuntu/backups/NohoSkies/NohoSkiesPhp.tgz *
 +
  echo uploading php files to s3
 +
  s3cmd put /home/ubuntu/backups/NohoSkies/NohoSkiesPhp.tgz s3://backup-dft-hadoop02/NohoSkies/
 +
fi
 +
 +
# --------------------------------------------------------------------------------
 +
# SYNC PHOTOS ONLY
 +
# --------------------------------------------------------------------------------
 +
cd /data/html/photos/files/
 +
s3cmd sync ./ s3://backup-dft-hadoop02/NohoSkies/files/
 +
 +
 +
</source>
 
<br />
 
<br />
 
</onlydft>
 
</onlydft>

Revision as of 10:53, 8 June 2018

D. Thiebaut (talk) 10:38, 25 May 2018 (EDT)



...