48 lines
1.2 KiB
Bash
Executable File
48 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# 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"
|
|
|
|
STARTTIME=$(date +%s)
|
|
|
|
# -s : file exists and has a size greater than zero
|
|
if [ ! -s "$piwiMountedCheckFile" ] ; then
|
|
echo "[refresh] Network not available (exists: $piwiMountedCheckFile)"
|
|
exit 1;
|
|
fi
|
|
|
|
# check if the file is really readable and contains text
|
|
mounted=$(cat "$piwiMountedCheckFile" 2>>/dev/null)
|
|
if [ -z $mounted ] ; then
|
|
echo "[refresh] Network not available (content: $piwiMountedCheckFile)"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$1" != "" ] && [ "$2" != "" ]
|
|
then
|
|
piwiRefreshCatId=$1
|
|
piwiRefreshSubCatId=$2
|
|
fi
|
|
|
|
|
|
perl -w /root/script/piwigo_refresh.pl \
|
|
--base_url="${piwiRefreshUrl}" \
|
|
--site=${piwiRefreshSiteId} \
|
|
--user="${piwiRefreshUser}" \
|
|
--password="${piwiRefreshPass}" \
|
|
--directory="${piwiRefreshSite}" \
|
|
--caddie=0 \
|
|
--privacy_level=${piwiRefreshPrivacy} \
|
|
--cat=${piwiRefreshCatId} \
|
|
--subcat=${piwiRefreshSubCatId}
|
|
|
|
ENDTIME=$(date +%s)
|
|
echo "Refresh took: $((($ENDTIME - $STARTTIME)/60)) minutes"
|