voidrice/.local/bin/change_timezones
2020-04-02 03:30:04 -04:00

20 lines
443 B
Bash
Executable File

#!/bin/sh
tz=$(date "+%Z")
if (( $EUID != 0 )); then
echo "Please run as root"
exit
elif [[ "$tz" == "CDT" ]]; then
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
echo "Changed to Eastern Daylight Time timezone"
elif [[ "$tz" == "EDT" ]]; then
ln -sf /usr/share/zoneinfo/US/Central /etc/localtime
echo "Changed to Central timezone"
fi
# Update system clock
echo "Updating system clock"
ntpd -gq >/dev/null 2>&1