Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2012-10-12 02:08:48 +0000
committershtrom <shtrom@1991c358-8f32-0410-a49a-990740bdf4c2>2012-10-12 02:08:48 +0000
commitec26ec7308c199dd943774599ad8d65c829787f0 (patch)
treee10738aebc6751cbd2915eed41d983aecec73438
parentdd9596b67b0485d63f257956f0f88996b1cfe404 (diff)
[scripts] Updated cloud_backup.sh with error checking and more flexibility.
git-svn-id: svn+ssh://scm.narf.ssji.net/svn/shtrom/scripts@1312 1991c358-8f32-0410-a49a-990740bdf4c2
-rwxr-xr-xcloud_backup.sh32
-rwxr-xr-xdelicious_backup.sh24
2 files changed, 32 insertions, 24 deletions
diff --git a/cloud_backup.sh b/cloud_backup.sh
new file mode 100755
index 0000000..a179383
--- /dev/null
+++ b/cloud_backup.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# $Id$
+# Use with cron:
+# 15 21 * * 4 /home/shtrom/bin/cloud_backup.sh
+delicious_USER=<+DELICIOUS_LOGIN+>
+delicious_PASS=<+DELICIOUS_PASS+>
+delicious_URL=https://api.del.icio.us/v1/posts/all
+#delicious_POST="include_tags=yes&include_notes=yes"
+
+_citeulike_USER=<+CITEULIKE_LOGIN+>
+#citeulike_USER=<+CITEULIKE_LOGIN+>
+#citeulike_PASS=<+CITEULIKE_PASS+>
+citeulike_URL="http://www.citeulike.org/bibtex/user/${_citeulike_USER}?incl_amazon=0&clean_urls=0&smart_wrap=0"
+
+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
+ 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}}
+ RET=$?
+ if [ $RET != 0 -o ! -s ${SITE}.${DATE} ];then
+ echo "$0: An error occurred with site ${SITE}: ret=${RET}"
+ fi
+done
diff --git a/delicious_backup.sh b/delicious_backup.sh
deleted file mode 100755
index 5d3c117..0000000
--- a/delicious_backup.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# $Id$
-delicious_USER=<+DELICIOUS_USER+>
-delicious_PASS=<+DELICIOUS_PASS+>
-delicious_URL=https://api.del.icio.us/v1/posts/all
-#delicious_POST="include_tags=yes&include_notes=yes"
-
-citeulike_USER=<+CITEULIKE_USER+>
-citeulike_PASS=<+CITEULIKE_PASS+>
-citeulike_URL="http://www.citeulike.org/bibtex/user/${citeulike_USER}?incl_amazon=0&clean_urls=0&smart_wrap=0"
-
-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
- wget --no-check-certificate -q -O ${SITE}.${DATE} \
- ${SITE_URL} ${SITE_POST:+--post-data ${SITE_POST}} \
- --user=${SITE_USER} --password=${SITE_PASS}
-done