User Tools

Site Tools


workshops:byo_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
workshops:byo_scripts [2010/07/31 00:42] rmoonenworkshops:byo_scripts [2017/10/12 21:58] (current) – external edit 127.0.0.1
Line 28: Line 28:
 {{:workshops:photo2html.tar.gz|Rob Moonen's Photo's to HTML scripts}}\\ {{:workshops:photo2html.tar.gz|Rob Moonen's Photo's to HTML scripts}}\\
  
-First master a CD with your images, using the directory structure you want to use on the webpage, mine starts with /camera_type/etc...+First master a CD with your images, using the directory structure you want to use on the webpage, mine starts with /camera_type/Img0001 etc...
 You will have to change the relative path in photo2html_table.sh to reflect this. You will have to change the relative path in photo2html_table.sh to reflect this.
  
Line 34: Line 34:
 Make your working directory path the same as the relative path on your CD except Make your working directory path the same as the relative path on your CD except
 on your www/photo_album root. Next copy the files from the CD subdirectory in there. on your www/photo_album root. Next copy the files from the CD subdirectory in there.
 +My CD directory structure is ${Camera_name}/IMG0001 etc...
 +The document root is /var/lib/apache/htdocs/www/photos this directory contains the photos in a structure Nikon/Img0001 etc... With about 80 photos per directory, actually the same as on CD. ;-)
  
 To prepare your images we use part of the imagemagick suite with this command: To prepare your images we use part of the imagemagick suite with this command:
   $ mogrify -size 120x120 *.jpg -resize 120x120 +profile "*"   $ mogrify -size 120x120 *.jpg -resize 120x120 +profile "*"
  
-Now run the photo2html script.+Now run the photo2html script thus: 
 +../../photo2html/photo2html.sh assuming the script is also under document root of your photo album, if not substitute the installed path to it. 
 + 
 +Document root of your photo album is Document root/photos
  
 The path for $base in photo2html.sh will have to be changed according to the distribution used. The path for $base in photo2html.sh will have to be changed according to the distribution used.
 +
 +Finally, make sure you have a symbolic link to your /cdrom in the document root directory, mine is Nikon/cdrom.
 +
 +
 +Oh, and here is a nice little five liner to do off-site backups of parts of your system, run
 +it as a cronjob in /etc/cron.daily but root will need to be using public key authentication so that there won't be a password requirement.
 +
 +<code>
 +#! /bin/bash
 +enum=`date +%F`
 +tar -czf /tmp/backup$enum.tgz /home/mint /etc/X11/xorg.conf /etc/crontab /etc/cron.daily /root/.ssh /var/cache/apt/archives --totals
 +scp -B /tmp/backup$enum.tgz robert@ares:/var/www/ares/mint
 +rm -rf /tmp/backup$enum.tgz
 +exit 0
 +</code>
 +
 +And here is the script to delete old backups:
 +
 +<code>
 +#!/bin/bash
 +COUNT=0
 +for file in `ls -c /var/www/ares/mint`
 +do
 +  COUNT=`expr $COUNT + 1`
 +  # If we have 8 backups, delete the last, so we only keep a weeks worth, deleting the oldest
 +  if [ 0$COUNT -eq 8 ]
 +  then
 +    rm /var/www/ares/mint/$file
 +    COUNT=`expr $COUNT - 1`
 +  fi
 +done
 +exit 0
 +</code>
 +
 +Run this script on your webserver.
 +Of course I could have just used find with the -exec option utilising rm, but I wanted to use bash. ;-)
workshops/byo_scripts.1280500975.txt.gz · Last modified: 2017/10/12 21:58 (external edit)