Skip to content

Instantly share code, notes, and snippets.

@gjpalau
Created March 4, 2015 15:49
Show Gist options
  • Save gjpalau/f15eea9a8f2c2dd85f97 to your computer and use it in GitHub Desktop.
Save gjpalau/f15eea9a8f2c2dd85f97 to your computer and use it in GitHub Desktop.
Script for managing timezones
#!/bin/bash
#### Set NTP Server
# Sets correct Timezone. If no Timezone is set, then default is CST
timezone=$1
if [ "$timezone" = "CST" ]
then
echo "America/Chicago"
systemsetup -settimezone America/Chicago
elif [ "$timezone" = "EST" ]
then
echo "America/New_York"
systemsetup -settimezone America/New_York
elif [ "$timezone" = "MST" ]
then
echo "America/Denver"
systemsetup -settimezone America/Denver
elif [ "$timezone" = "PST" ]
then
echo "America/Los_Angeles"
systemsetup -settimezone America/Los_Angeles
else
echo "No input provided -- Defaulting to Central Time"
echo "America/Chicago"
systemsetup -settimezone America/Chicago
fi
systemsetup -setnetworktimeserver insert.time.server.here
systemsetup -setusingnetworktime on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment