Always dispose of the latest version

25 views
Skip to first unread message

Blackmagic

unread,
Oct 22, 2014, 7:39:51 AM10/22/14
to brow...@googlegroups.com
Hello,

Probably some other people already posted something similar but here is a small bash script that one can use to check on a regular basis (daily???) that the latest version of the browscap.ini file is being used

#!/bin/bash

# Where do you store your browscap.ini file
BASEPATH=/var/www

##
## No need to edit below this line
##
LOCALVERSION=0
REMOTEVERSION=$(wget -qO- http://browscap.org/version-number)

# If we have already imported the browscap file once, there should be a versioning file
if [ -f "$BASEPATH/browscap_version" ]
then
LOCALVERSION=$(<"$BASEPATH/browscap_version")
fi

# Is the local version older than the remote version?
if [ $LOCALVERSION -ne $REMOTEVERSION ]
then
echo "Local version is $LOCALVERSION"
echo "Updating to version $REMOTEVERSION"
wget --quiet -O "$BASEPATH/browscap.ini" http://browscap.org/stream?q=PHP_BrowsCapINI
if [ $? -eq 0 ]
then
httpd -k restart
wget -q -O "$BASEPATH/browscap_version" http://browscap.org/version-number
else
echo "Unable to download version $REMOTEVERSION"
echo "Version $LOCALVERSION remains the locally installed version"
fi
else
echo "Version $LOCALVERSION is the most recent one"
fi

Reply all
Reply to author
Forward
0 new messages