Shell Script To Cache Feedburner.com Chicklet Locally

in Categories File-management, HTTP, Web Server last updated May 27, 2008

A shell script to cache feedburner.com chicklet locally to improve performance by making fewer external http requests.

Install this script using a cron job:
@daily /path/to/script.sh

#!/bin/bash
# Shell Script to cache feedburner.com Chicklet locally
# -------------------------------------------------------------------------
# Copyright (c) 2007 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Set me first #
# Your Feedburner url
FURL="http://feeds.feedburner.com/~fc/Nixcraft-LinuxFreebsdSolarisTipsTricks"
# local path to save gif file
LOCALFILE="/var/www/images/rss/feedburner.gif"
# local web server user
WUSER="lighttpd"
WGROUP="lighttpd"
 
# get file using wget  and set permissions
# $$ pass current PID to avoid Feedburner.com cache 
/usr/bin/wget -O "${LOCALFILE}" "${FURL}?$$" &> /dev/null
chown ${WUSER}:${WGROUP} ${LOCALFILE}

Run above script and modify your template / html code with following :

<img src="/path/to/feedburner.gif" alt="">

Share this on: