source: Serveur/flashpolicyd/flashpolicyd-2.1/flashpolicyd.sh @ 2848

Last change on this file since 2848 was 2848, checked in by kent1, 10 years ago

Pas mal de modifications pour le faire fonctionner correctement sur debian

File size: 2.1 KB
Line 
1#!/bin/bash
2#
3# Init file for the flashpolicy server daemon
4#
5# description: Starts a server on port 843 to server flash policy requests
6#
7# processname: flashpolicyd.rb
8
9### BEGIN INIT INFO
10# Provides:             flashpolicyd
11# Required-Start:       $syslog
12# Required-Stop:        $syslog
13# Should-Start:         $network
14# Should-Stop:          $network
15# Default-Start:        2 3 4 5
16# Default-Stop:         0 1 6
17# Short-Description:    flashpolicyd -  Flash socket policy server
18# Description:          flashpolicyd provide a flash sochet policy server.
19### END INIT INFO
20
21#####################
22#BEGIN CONFIG SECTION
23
24# Source function library.
25. /lib/lsb/init-functions
26
27NAME=flashpolicyd
28DESC="Flashpolicy server"
29
30# Location of daemon
31DAEMON=/usr/local/sbin/flashpolicyd.rb
32
33# Location of socket policy file (configuration)
34XML=/usr/local/etc/flashpolicy.xml
35
36# Log file in /var/log/ for logging
37LOGFILE=/var/log/flashpolicyd.log
38
39# Time refreshing the log file
40LOGFREQ=1800
41
42# Time where people can connect
43TIMEOUT=10
44
45# Pid file
46PIDFILE="/var/run/$NAME.pid"
47
48# User
49USER=root
50
51# Include flashpolicyd defaults if available
52if [ -f /etc/default/flashpolicyd ] ; then
53        . /etc/default/flashpolicyd
54fi
55
56# Options of the daemon
57DAEMON_OPTS="--timeout=$TIMEOUT --xml=$XML --pidfile=$PIDFILE --logfreq=$LOGFREQ --logfile=$LOGFILE"
58
59[ "$NETWORKING" = "no" ] && exit 0
60[ -f "$DAEMON" ] || exit 1
61[ -f "$XML" ] || exit 1
62
63RETVAL=0
64
65start() {
66        echo -n "Starting $DESC: "
67        start-stop-daemon --start --quiet --pidfile $PIDFILE \
68                --chuid $USER \
69                --exec $DAEMON -- $DAEMON_OPTS
70        echo "$NAME."
71}
72
73stop() {
74        echo -n "Stopping $DESC : "
75        start-stop-daemon --stop --quiet --pidfile $PIDFILE \
76                --oknodo
77        echo "$NAME."
78}
79
80restart() {
81        stop
82        sleep 1
83        start
84}
85
86status() {
87        PID=$(cat $PIDFILE)
88        if [ -n "$PID" ]; then
89                log_success_msg "$DESC is running (pid $PID)."
90                        exit 0
91        else
92                log_failure_msg "$DESC is not running."
93                        exit 1
94        fi
95}
96
97case "$1" in
98  start)
99                start
100        ;;
101  stop)
102                stop
103        ;;
104  status)
105                status
106        ;;
107  restart|reload)
108        restart
109    ;;
110  *)
111    echo "Usage: flashpolicyd {start|stop|status|restart}"
112    RETVAL=1
113esac
114
115exit $RETVAL
Note: See TracBrowser for help on using the repository browser.