Friday, July 25, 2014

Done a little bit of (shell) programming

Here it is...

#!/bin/bash
# Script file to synchronise LAMP files. Ian Bruntlett July 2014
FILES_LAMP=/var/www/html
FILES_STICK=/media/$LOGNAME/DARWIN/lamp/html
FILES_CP_OPTS="-irvua"
echo Running $0
ls -lh $0
echo Ensuring destination directory $FILES_STICK exists
mkdir -p $FILES_STICK
echo Copy files from live LAMP directory to memory stick
cp $FILES_CP_OPTS $FILES_LAMP/* --target-directory=$FILES_STICK
echo Copy files from memory stick to hard disc
cp $FILES_CP_OPTS $FILES_STICK/* --target-directory=$FILES_LAMP
echo $0 done

No comments: