Adding duration calculation

Additional checks if image source is available
This commit is contained in:
2019-05-23 13:57:29 +02:00
parent 580bac4e0f
commit e64ca0bb9f

View File

@@ -1,8 +1,24 @@
#!/bin/bash #!/bin/bash
mountedCheckFile="/home/network/Qbilder/photos/.mounted"
catId=0 catId=0
subCatId=1 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" != "" ] if [ "$1" != "" ] && [ "$2" != "" ]
then then
catId=$1 catId=$1
@@ -20,3 +36,6 @@ perl -w /root/script/piwigo_refresh.pl \
--privacy_level=4 \ --privacy_level=4 \
--cat=${catId} \ --cat=${catId} \
--subcat=${subCatId} --subcat=${subCatId}
ENDTIME=$(date +%s)
echo "Refresh took: $((($ENDTIME - $STARTTIME)/60)) minutes"