Ignore:
Timestamp:
2011-11-14T03:38:51+01:00 (4 years ago)
Author:
nico
Message:

packages/ptunnel: use new service functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • packages/net/ptunnel/files/ptunnel.init

    r17608 r29098  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2007-2009 OpenWrt.org 
     2# Copyright (C) 2007-2011 OpenWrt.org 
    33 
    44START=70 
    5 BIN=ptunnel 
    6 PIDCOUNT=0 
    75 
    8 start() { 
    9         include /lib/network 
    10         scan_interfaces 
    11  
    12         config_load ptunnel 
    13         config_foreach start_ptunnel ptunnel 
    14         iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null 
    15 } 
    16  
    17 start_ptunnel() { 
     6start_instance() { 
    187        local section="$1" 
    198 
     
    2211 
    2312        [ -z "$ifname" ] && { 
    24                 echo "Error: Interface '$interface' not found" 1>&2 
     13                echo "${initscript}: Error: Interface '$interface' not found" 1>&2 
    2514                return 1 
    2615        } 
    2716 
    28         PIDCOUNT="$(( ${PIDCOUNT} + 1))" 
    29         ${BIN} -c "$ifname" -daemon /var/run/ptunnel."$PIDCOUNT".pid> /dev/null 
     17        SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid" 
     18        service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE 
     19} 
     20 
     21start() { 
     22        include /lib/network 
     23        scan_interfaces 
     24 
     25        config_load 'ptunnel' 
     26        config_foreach start_instance 'ptunnel' 
     27        iptables -I OUTPUT 1 -p icmp -j ACCEPT 2> /dev/null 
    3028} 
    3129 
    3230stop() { 
    33         local pidfile 
    34  
    35         for pidfile in `ls /var/run/${BIN}.*.pid` 
    36         do 
    37                 start-stop-daemon -K -s KILL -p "${pidfile}" -n "${BIN}" >/dev/null 
    38                 rm -f "${pidfile}" 
    39         done 
     31        service_stop /usr/sbin/ptunnel 
    4032} 
Note: See TracChangeset for help on using the changeset viewer.