initial upload
This commit is contained in:
commit
867ac1955d
10 changed files with 495 additions and 0 deletions
24
delicious_backup.sh
Executable file
24
delicious_backup.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Fetches all your delicious bookmarks
|
||||
# and validates the XML before saving.
|
||||
# Requires xmlstarlet
|
||||
|
||||
DEL_USER=foo
|
||||
DEL_PASS=bar
|
||||
API_URL=api.del.icio.us/v1/posts/all
|
||||
BKP_FILE=/home/username/deliciousbackup.xml
|
||||
|
||||
# When no backup exists, just do it
|
||||
if [ ! -f $BKP_FILE ]; then
|
||||
curl -s https://$DEL_USER:$DEL_PASS@$API_URL > $BKP_FILE
|
||||
else
|
||||
curl -s https://$DEL_USER:$DEL_PASS@$API_URL > $BKP_FILE.tmp
|
||||
# if XML is valid, move to final destination
|
||||
if [ $(xmlstarlet validate $BKP_FILE.tmp > /dev/null 2>&1; echo $?) -gt 0 ]; then
|
||||
rm $BKP_FILE.tmp
|
||||
echo "Downloaded XML file not valid. Previous backup preserved."
|
||||
else
|
||||
mv $BKP_FILE.tmp $BKP_FILE
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue