]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Use lockfiles.
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 17 Sep 2006 19:05:59 +0000 (19:05 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sun, 17 Sep 2006 19:05:59 +0000 (19:05 +0000)
svn-id: @7785

rc.d/init.d/timezone

index 6d3f5a15e9513da3aefb7185b87b1fdf42361ec4..c60c518bad177fdc1ea8a2a0f46d763a3f3f7fef 100644 (file)
@@ -28,21 +28,27 @@ ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
 [ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" = "$ZONE_FILE" ] && exit 0
 
 start() {
-       rm -f /etc/localtime
-       if [ -f "$ZONE_FILE" ]; then
-               if [ -n "$ZONE_INFO_AREA" ]; then
-                       MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
-               else
-                       MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
+       if [ ! -f /var/lock/subsys/timezone ]; then
+               rm -f /etc/localtime
+               if [ -f "$ZONE_FILE" ]; then
+                       if [ -n "$ZONE_INFO_AREA" ]; then
+                               MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
+                       else
+                               MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
+                       fi
+                       run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
+                       RETVAL=$?
                fi
-               run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
-               RETVAL=$?
+
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/timezone
        fi
 }
 
 stop() {
-       run_cmd "Unsetting time zone information" rm -f /etc/localtime
-       RETVAL=$?
+       if [ -f /var/lock/subsys/timezone ]; then
+               run_cmd "Unsetting time zone information" rm -f /etc/localtime
+               rm -f /var/lock/subsys/timezone
+       fi
 }
 
 RETVAL=0
This page took 0.102983 seconds and 4 git commands to generate.