Created
October 18, 2012 18:43
-
-
Save rpherrera/3914019 to your computer and use it in GitHub Desktop.
Updates the Sao_Paulo Timezone (2012..2016) and does some basic checking after that
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Updates the Sao_Paulo Timezone (2012..2016) and does some basic checking after that | |
echo -n 'Checking for zic: ' | |
which zic &>/dev/null | |
if [ ${?} -eq 0 ] | |
then | |
echo -ne 'OK\n' | |
else | |
echo -ne 'FAILED\n' | |
exit 1 | |
fi | |
echo -n 'Checking for zdump: ' | |
which zdump &>/dev/null | |
if [ ${?} -eq 0 ] | |
then | |
echo -ne 'OK\n' | |
else | |
echo -ne 'FAILED\n' | |
exit 1 | |
fi | |
echo 'Backing up /etc/localtime to /etc/localtime.bkp' | |
sudo cp /etc/localtime{,.bkp} | |
echo "Passing timezone rules to zic @ ${HOSTNAME}" | |
cat <<EOF | sudo zic | |
Rule Brazil 2012 only - Feb 26 00:00 0 S | |
Rule Brazil 2012 only - Oct 21 00:00 1 D | |
Rule Brazil 2013 only - Feb 17 00:00 0 S | |
Rule Brazil 2013 only - Oct 20 00:00 1 D | |
Rule Brazil 2014 only - Feb 16 00:00 0 S | |
Rule Brazil 2014 only - Oct 19 00:00 1 D | |
Rule Brazil 2015 only - Feb 22 00:00 0 S | |
Rule Brazil 2015 only - Oct 18 00:00 1 D | |
Rule Brazil 2016 only - Feb 21 00:00 0 S | |
Zone Brazil/East -3:00 Brazil BR%sT | |
EOF | |
echo "Checking up years between 2012 and 2016..." | |
for i in `seq 2 6` | |
do | |
contents=`zdump -v /etc/localtime | grep -e "201[${i}]"` | |
echo -ne "\n201${i}: " | |
[ "${contents}" != "" ] && echo -ne "OK\n${contents}\n" || echo -ne 'FAILED\n' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment