Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2014-03-27 23:41:28 +0000
committershtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2014-03-27 23:41:28 +0000
commit6703a275de25f5937245c41a6634ce8ecdf5a749 (patch)
tree3d6aeba26d0c219ef9d5a07e8861d7a6d29fa778 /cloud_backup.sh
parent7b97e5b13fa6a5cf6635c1faa728c689882a4f03 (diff)
[cloud_backup] Make a function of the downloading command
git-svn-id: svn+ssh://scm.narf.ssji.net/svn/shtrom/scripts@1777 1991c358-8f32-0410-a49a-990740bdf4c2
Diffstat (limited to 'cloud_backup.sh')
-rwxr-xr-xcloud_backup.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/cloud_backup.sh b/cloud_backup.sh
index a179383..3ef4bbc 100755
--- a/cloud_backup.sh
+++ b/cloud_backup.sh
@@ -16,15 +16,25 @@ SITES="delicious citeulike"
DATE=`date +%Y-%m-%d`
-for SITE in ${SITES}; do
- eval SITE_USER=\$${SITE}_USER
- eval SITE_PASS=\$${SITE}_PASS
- eval SITE_URL=\$${SITE}_URL
- eval SITE_POST=\$${SITE}_POST
+function wgetit() {
+ SITE=$1
+ DATE=$2
+ SITE_URL=$3
+ SITE_USER=$4
+ SITE_PASS=$5
+ SITE_POST=$6
wget -U "$0" --no-check-certificate -q -O ${SITE}.${DATE} \
${SITE_URL} ${SITE_POST:+--post-data ${SITE_POST}} \
${SITE_USER:+--user=${SITE_USER}} \
${SITE_PASS:+--password=${SITE_PASS}}
+}
+
+for SITE in ${SITES}; do
+ eval SITE_URL=\$${SITE}_URL
+ eval SITE_USER=\$${SITE}_USER
+ eval SITE_PASS=\$${SITE}_PASS
+ eval SITE_POST=\$${SITE}_POST
+ wgetit "$SITE" "$DATE" "$SITE_URL" "$SITE_USER" "$SITE_PASS" "$SITE_POST"
RET=$?
if [ $RET != 0 -o ! -s ${SITE}.${DATE} ];then
echo "$0: An error occurred with site ${SITE}: ret=${RET}"