User Tools

Site Tools


workshops:byo_scripts

This is an old revision of the document!


BYO Scripts

We talked about many different scripts and scripting languages.

Our verdict
C - Not a scripting language but Bob uses it for everything and loves it.
Ruby - Great language
Python - Closely follows
Perl - Minimal lines of code, messy looking language
Bash - Can be restricting and hard to read

Here are some of the scripts we covered:

Michael Pope's Backup Scripts

Michael Pope's Backup scripts
To run my scripts make sure you have ruby installed. If you are on a debian/Ubuntu based computer type:

$ sudo apt-get install ruby

Also make sure you modify the top of my scripts to backup the directories and devices relating to your computer.

backup-ltsp - Performs a 7 day rolling system and separate data backup using fsarchiver and tar with multi-core compression options. Full logging is enabled. This script is to be used in cron.

backup-chroot-ltsp - If you use LTSP1) then this maybe handy as it backs up your client image section.

Rob Moonen's Photo to HTML Scripts

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… You will have to change the relative path in photo2html_table.sh to reflect this.

Next change to your working html directory and prepare your thumbnails in there. 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.

To prepare your images we use part of the imagemagick suite with this command:

$ mogrify -size 120x120 *.jpg -resize 120x120 +profile "*"

Now run the photo2html script.

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.

#! /bin/bash
enum=`date +%F`
tar -czf /tmp/eros-backup$enum.tgz /home/mint /etc/X11/xorg.conf /etc/crontab /etc/cron.daily /root/.ssh /var/cache/apt/archives --totals
scp -B /tmp/eros-backup$enum.tgz robert@ares:/var/www/ares/mint
rm -rf /tmp/eros-backup$enum.tgz
1)
Linux Terminal Server Project
workshops/byo_scripts.1280635272.txt.gz · Last modified: 2017/10/12 21:58 (external edit)