packages/updatedd: use new service functions
[openwrt/svn-archive/archive.git] / net / updatedd / files / updatedd.init
index d364659008f7d45c87d4b212407ad964a5c3064b..5ae4545e2fd5d8ac52be44a05ca3667ca82a2748 100644 (file)
@@ -1,14 +1,15 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
+
 START=50
 
-start_service () {
+start_instance () {
        local section="$1"
-       config_get service  "$section" service
-       config_get username "$section" username
-       config_get password "$section" password
-       config_get host     "$section" host
-       config_get update   "$section" update
+       config_get service  "$section" 'service'
+       config_get username "$section" 'username'
+       config_get password "$section" 'password'
+       config_get host     "$section" 'host'
+       config_get update   "$section" 'update'
 
        [ "$update" = 1 ] && {
                if [ "$service" = "dyndns" ]; then
@@ -22,16 +23,16 @@ start_service () {
                        fi
                fi
                if [ "$abusive" != "1" ]; then
-                       /usr/bin/updatedd -Y $service -- $username:$password $host
+                       service_start /usr/bin/updatedd -Y $service -- $username:$password $host
                fi
        }
 }
 
 start() {
-       config_load "updatedd"
-       config_foreach start_service updatedd
+       config_load 'updatedd'
+       config_foreach start_instance 'updatedd'
 }
 
 stop() {
-       killall updatedd
+       service_stop /usr/bin/updatedd
 }