-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeTZ.sh
More file actions
37 lines (35 loc) · 1019 Bytes
/
changeTZ.sh
File metadata and controls
37 lines (35 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
MYTZ=America/New_York
#MYTZ=Asia/Jerusalem
ENV=`env | grep "OVERRIDE_TZ_EST=1"`
if [ $? -eq 0 ]
then
TZ=EST
echo "TZ=$TZ" >> /etc/profile
echo "export TZ" >> /etc/profile
exit 0
fi
RELEASE=`grep ^ID /etc/os-release`
if [[ $RELEASE =~ centos ]] || [[ $RELEASE =~ fedora ]]
then
echo "Release is centos or fedora"
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
#ln -s /usr/share/zoneinfo/Asia/Jerusalem /etc/localtime
readlink /etc/localtime
elif [[ $RELEASE =~ ubuntu ]]
then
echo "Release is Ubuntu"
apt-get install -yq tzdata
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
elif [[ $RELEASE =~ alpine ]]
then
echo "Release is Alpine"
apk add --no-cache tzdata
else
echo "None of the above releases is on this machine"
fi
TZ=$MYTZ
echo "TZ=$TZ" >> /etc/profile
echo "export TZ" >> /etc/profile