Files
piwigo_scan/piwirefresh.sh
Martin Winkler e64ca0bb9f Adding duration calculation
Additional checks if image source is available
2019-05-23 13:57:29 +02:00

42 lines
924 B
Bash
Executable File

#!/bin/bash
mountedCheckFile="/home/network/Qbilder/photos/.mounted"
catId=0
subCatId=1
STARTTIME=$(date +%s)
# -s : file exists and has a size greater than zero
if [ ! -s "$mountedCheckFile" ] ; then
echo "[refresh] Network not available (exists: $mountedCheckFile)"
exit 1;
fi
# check if the file is really readable and contains text
mounted=$(cat "$mountedCheckFile" 2>>/dev/null)
if [ -z $mounted ] ; then
echo "[refresh] Network not available (content: $montedCheckFile)"
exit 1;
fi
if [ "$1" != "" ] && [ "$2" != "" ]
then
catId=$1
subCatId=$2
fi
perl -w /root/script/piwigo_refresh.pl \
--base_url=https://change.me/gallery \
--site=2 \
--user="-change me-" \
--password="-change me-" \
--directory="/var/www/piwigo/network" \
--caddie=0 \
--privacy_level=4 \
--cat=${catId} \
--subcat=${subCatId}
ENDTIME=$(date +%s)
echo "Refresh took: $((($ENDTIME - $STARTTIME)/60)) minutes"