source: Serveur/flashpolicyd/flashpolicyd_0_6_adobe/flashpolicyd.sh @ 2852

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

On améliore un chouilla

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