source: packages/net/stunnel/files/stunnel.init @ 18994

Last change on this file since 18994 was 18994, checked in by florian, 6 years ago

[package] fix stunnel restart, bump makefile (#5897, #6220)

  • Property svn:eol-style set to native
File size: 667 bytes
Line 
1#!/bin/sh /etc/rc.common
2# Copyright (C) 2006-2008 OpenWrt.org
3
4START=90
5RUN_D=/var
6PID_F=$RUN_D/stunnel.pid
7
8start() {
9        if [ -s "/etc/stunnel/stunnel.pem" ]; then
10                chmod og-rwx /etc/stunnel/stunnel.pem
11                [ ! -f $PID_F ] && stunnel
12        else
13                [ -e /etc/stunnel/config ] && \
14                . /etc/stunnel/config
15
16                X509_CN=${X509_CN:-"router"}
17                X509_O=${X509_O:-"openwrt.org"}
18                X509_OU=${X509_OU:-"open-source firmware"}
19
20                [ -x /sbin/keygen ] && {
21                (keygen "$X509_CN" "$X509_O" "$X509_OU" > /etc/stunnel/stunnel.pem;
22                        chmod og-rwx /etc/stunnel/stunnel.pem;
23                        stunnel) &
24                }
25        fi
26}
27
28stop() {
29        [ -f $PID_F ] && {
30                kill $(cat $PID_F)
31                kill -9 $(cat $PID_F)
32                rm -f $PID_F
33        }
34}
Note: See TracBrowser for help on using the repository browser.