Make the scripts configurable and provide example
This commit is contained in:
@@ -1,41 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
mountedCheckFile="/home/network/Qbilder/photos/.mounted"
|
||||
catId=0
|
||||
subCatId=1
|
||||
# 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 "$mountedCheckFile" ] ; then
|
||||
echo "[refresh] Network not available (exists: $mountedCheckFile)"
|
||||
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 "$mountedCheckFile" 2>>/dev/null)
|
||||
mounted=$(cat "$piwiMountedCheckFile" 2>>/dev/null)
|
||||
if [ -z $mounted ] ; then
|
||||
echo "[refresh] Network not available (content: $montedCheckFile)"
|
||||
echo "[refresh] Network not available (content: $piwiMountedCheckFile)"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ "$1" != "" ] && [ "$2" != "" ]
|
||||
then
|
||||
catId=$1
|
||||
subCatId=$2
|
||||
piwiRefreshCatId=$1
|
||||
piwiRefreshSubCatId=$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" \
|
||||
--base_url="${piwiRefreshUrl}" \
|
||||
--site=${piwiRefreshSiteId} \
|
||||
--user="${piwiRefreshUser}" \
|
||||
--password="${piwiRefreshPass}" \
|
||||
--directory="${piwiRefreshSite}" \
|
||||
--caddie=0 \
|
||||
--privacy_level=4 \
|
||||
--cat=${catId} \
|
||||
--subcat=${subCatId}
|
||||
--privacy_level=${piwiRefreshPrivacy} \
|
||||
--cat=${piwiRefreshCatId} \
|
||||
--subcat=${piwiRefreshSubCatId}
|
||||
|
||||
ENDTIME=$(date +%s)
|
||||
echo "Refresh took: $((($ENDTIME - $STARTTIME)/60)) minutes"
|
||||
|
Reference in New Issue
Block a user