3 # timezone Set time zone information.
4 # chkconfig: 2345 10 70
5 # description: This script is setting time zone information for your machine.
6 # Author: Pawel Wilk <siefca@pld-linux.org>
10 # Source function library.
11 . /etc/rc.d/init.d/functions
13 [ ! -f /etc/sysconfig/timezone ] && exit 0
14 . /etc/sysconfig/timezone
16 ZONE_FILE="$ZONE_INFO_DIR"
18 if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
19 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
22 if [ -n "$ZONE_INFO_AREA" ]; then
23 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
26 ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
28 [ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" = "$ZONE_FILE" ] && exit 0
31 if [ ! -f /var/lock/subsys/timezone ]; then
32 if [ -f "$ZONE_FILE" ]; then
35 if [ -n "$ZONE_INFO_AREA" ]; then
36 MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
38 MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
40 run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/timezone
49 if [ -f /var/lock/subsys/timezone ]; then
50 run_cmd "Unsetting time zone information" rm -f /etc/localtime
51 rm -f /var/lock/subsys/timezone
56 # See how we were called.
69 msg_usage "$0 {start|stop|restart|reload}"