source: packages/net/ptunnel/files/ptunnel.init @ 29098

Last change on this file since 29098 was 29098, checked in by nico, 5 years ago

packages/ptunnel: use new service functions

File size: 641 bytes
Line 
1#!/bin/sh /etc/rc.common
2# Copyright (C) 2007-2011 OpenWrt.org
3
4START=70
5
6start_instance() {
7        local section="$1"
8
9        config_get interface "$section" interface
10        config_get ifname "$interface" ifname
11
12        [ -z "$ifname" ] && {
13                echo "${initscript}: Error: Interface '$interface' not found" 1>&2
14                return 1
15        }
16
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
28}
29
30stop() {
31        service_stop /usr/sbin/ptunnel
32}
Note: See TracBrowser for help on using the repository browser.