~jbauer/paritybit.ca

paritybit.ca/uploadwatch.sh -rwxr-xr-x 364 bytes
c8b1e086Jake Bauer Publish new blog post 2 days ago
                                                                                
1
2
3
4
5
6
7
8
9
#!/bin/bash

DESTDIR=/var/www/
WATCHDIR=/home/manager/uploads/

mkdir -p "$WATCHDIR"
touch /home/manager/upload.log

find "$WATCHDIR" -mindepth 1 -maxdepth 1 -exec sh -c 'if [ ! "$1" = "" ]; then echo "==========" >> /home/manager/upload.log && rsync -vr "$1" "$2" >> /home/manager/upload.log && rm -r $1 && chown -R www-data:www-data "$2"; fi' - {} "$DESTDIR" \;