Created
February 1, 2012 11:30
-
-
Save chmouel/1716657 to your computer and use it in GitHub Desktop.
change time
This file contains hidden or 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 | |
set -e | |
set -x | |
LOCALTZMD5=$(md5sum /etc/localtime|sed 's/ .*//') | |
TIMEZONE="Europe/London Europe/Paris America/Chicago America/Los_Angeles" | |
for tz in ${TIMEZONE};do | |
[[ -e /usr/share/zoneinfo/${tz} ]] || exit 1 | |
md5=$(md5sum /usr/share/zoneinfo/${tz}|sed 's/ .*//') | |
[[ ${LOCALTZMD5} == ${md5} ]] && { echo "Current: ${tz}, $(date)" ; break ;} | |
done | |
select tz in ${TIMEZONE};do | |
[[ -e /usr/share/zoneinfo/${tz} ]] || exit 1 | |
sudo cp /usr/share/zoneinfo/${tz} /etc/localtime | |
echo ${tz}|sudo tee /etc/timezone >/dev/null | |
break | |
done | |
date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment