Make the scripts configurable and provide example

This commit is contained in:
2019-05-23 14:50:19 +01:00
parent d57c3c3546
commit e90151b1b5
3 changed files with 67 additions and 46 deletions

View File

@@ -1,24 +1,35 @@
#!/bin/bash
myyear=$(date "+%Y")
# Get script working directory
# (when called from a different directory)
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
if [ ! -s "$WDIR/config.sh" ] ; then
echo "No configuration found"
exit 1;
fi
. "$WDIR/config.sh"
myyear=$(date "+%Y")
if [ "$1" != "" ]
then
myyear=$1
#echo Error subdir parameter missing
#exit 1;
fi
subDir="$myyear/"
piwigoThumbRoot="/var/www/piwigo/_data/i/network/network/${subDir}"
networkPhotoRoot="/home/network/Qbilder/photos/${subDir}"
thumbRoot="${piwiThumbRoot}/${subDir}"
photoRoot="${piwiPhotoRoot}/${subDir}"
if [ ! -e ${networkPhotoRoot} ]
then
echo "${networkPhotoRoot} not found"
if [ ! -e ${thumbRoot} ] ; then
echo "Thumbnail root ${thumbRoot} not found"
exit 1;
fi
/root/script/piwigo_thumbgen.sh "${networkPhotoRoot}" "${piwigoThumbRoot}"
if [ ! -e ${photoRoot} ] ; then
echo "Photo root ${photoRoot} not found"
exit 1;
fi
/root/script/piwirefresh.sh
$WDIR/piwigo_thumbgen.sh "${photoRoot}" "${thumbRoot}"
$WDIR/piwirefresh.sh