packages/fanctrolled: use new service functions
[openwrt/svn-archive/archive.git] / utils / fancontroled / files / fancontroled.init
index 2ec5e87..b872553 100644 (file)
@@ -3,6 +3,10 @@
 START=75
 STOP=75
 
+SERVICE_NAME="fancontroled"
+SERVICE_COMMAND="/usr/sbin/$SERVICE_NAME"
+SERVICE_PID_FILE="/var/run/$SERVICE_NAME.pid"
+
 TEMP_SENSOR_CHIP=lm75
 TEMP_READ_FIELD=temp1_input
 MIN_TEMP=30
@@ -11,12 +15,11 @@ FAN_SENSOR_CHIP=g760a
 FAN_CONTROL_FIELD=pwm1
 PWM_FAN_MIN=1
 PWM_FAN_MAX=180
-PID_FILENAME=/var/run/fancontroled.pid
 
 start() {
-       /usr/sbin/fancontroled -t $TEMP_SENSOR_CHIP -r $TEMP_READ_FIELD -m $MIN_TEMP -M $MAX_TEMP -f $FAN_SENSOR_CHIP -c $FAN_CONTROL_FIELD -p $PWM_FAN_MIN -P $PWM_FAN_MAX -z $PID_FILENAME
+       service_start $SERVICE_COMMAND -t $TEMP_SENSOR_CHIP -r $TEMP_READ_FIELD -m $MIN_TEMP -M $MAX_TEMP -f $FAN_SENSOR_CHIP -c $FAN_CONTROL_FIELD -p $PWM_FAN_MIN -P $PWM_FAN_MAX -z $SERVICE_PID_FILE
 }
 
 stop() {
-       kill $(cat $PID_FILENAME)
+       service_stop $SERVICE_COMMAND
 }