3 # timezone Set time zone information.
4 # chkconfig: 2345 10 90
5 # description: This script is setting time zone information for your machine.
6 # Author: Pawel Wilk <siefca@pld-linux.org>
10 [ -f /etc/sysconfig/timezone ] || exit 0
12 # Source function library.
13 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/timezone
17 ZONE_FILE="$ZONE_INFO_DIR"
19 if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
20 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
23 if [ -n "$ZONE_INFO_AREA" ]; then
24 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
27 ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
29 [ -L /etc/localtime ] && [ "$(resolvesymlink /etc/localtime)" = "$ZONE_FILE" ] && exit 0
32 if [ ! -f /var/lock/subsys/timezone ]; then
33 if [ -f "$ZONE_FILE" ]; then
36 if [ -n "$ZONE_INFO_AREA" ]; then
37 MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
39 MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
41 run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/timezone
50 if [ -f /var/lock/subsys/timezone ]; then
51 rm -f /var/lock/subsys/timezone
56 run_cmd "Unsetting time zone information" rm -f /etc/localtime
60 # See how we were called.
68 restart|try-restart|reload|force-reload)
76 if [ -n "$ZONE_INFO_AREA" ]; then
77 nls 'Time zone configured to (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"
79 nls 'Time zone configured to (%s)' "$TIME_ZONE"
83 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|disable|status}"