Ignore:
Timestamp:
01/04/10 00:27:01 (10 years ago)
Author:
kent1
Message:

Pas mal de modifications pour le faire fonctionner correctement sur debian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Serveur/flashpolicyd/flashpolicyd-2.1/flashpolicyd.sh

    r2844 r2848  
    33# Init file for the flashpolicy server daemon
    44#
    5 # chkconfig: 2345 20 20
    65# description: Starts a server on port 843 to server flash policy requests
    76#
    87# processname: flashpolicyd.rb
    98
     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
    1024# Source function library.
    11 . /etc/rc.d/init.d/functions
     25. /lib/lsb/init-functions
    1226
    13 desc="Flash policy server"
    14 prog="flashpolicyd"
     27NAME=flashpolicyd
     28DESC="Flashpolicy server"
    1529
    16 # these can be overrode in /etc/sysconfig/flashpolicyd
    17 RETVAL=0
    18 TIMEOUT=10
    19 XML=/etc/flashpolicy.xml
    20 LOGFREQ=1800
     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
    2137LOGFILE=/var/log/flashpolicyd.log
    2238
    23 if [ -r /etc/sysconfig/$prog ]; then
    24         source /etc/sysconfig/$prog
     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
    2554fi
    2655
     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
    2765start() {
    28         echo -n $"Starting $desc ($prog): "
    29         daemon --check=$prog /usr/sbin/${prog} --timeout=${TIMEOUT} --xml=${XML} --logfreq=${LOGFREQ} --logfile=${LOGFILE}
    30         RETVAL=$?
    31         echo
    32         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    33         return $RETVAL
     66        echo -n "Starting $DESC: "
     67        start-stop-daemon --start --quiet --pidfile $PIDFILE \
     68                --chuid $USER \
     69                --exec $DAEMON -- $DAEMON_OPTS
     70        echo "$NAME."
    3471}
    3572
    3673stop() {
    37         echo -n $"Stopping $desc ($prog): "
    38         killproc $prog
    39         RETVAL=$?
    40         echo
    41         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
    42         return $RETVAL
     74        echo -n "Stopping $DESC : "
     75        start-stop-daemon --stop --quiet --pidfile $PIDFILE \
     76                --oknodo
     77        echo "$NAME."
    4378}
    4479
    4580restart() {
    4681        stop
     82        sleep 1
    4783        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
    4895}
    4996
    5097case "$1" in
    5198  start)
    52         start
     99                start
    53100        ;;
    54101  stop)
    55         stop
    56         ;;
    57   restart)
    58         restart
    59         ;;
    60   condrestart)
    61         [ -e /var/lock/subsys/$prog ] && restart
    62         RETVAL=$?
     102                stop
    63103        ;;
    64104  status)
    65         status $prog
    66         RETVAL=$?
     105                status
    67106        ;;
     107  restart|reload)
     108        restart
     109    ;;
    68110  *)
    69         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
    70         RETVAL=1
     111    echo "Usage: flashpolicyd {start|stop|status|restart}"
     112    RETVAL=1
    71113esac
    72114
Note: See TracChangeset for help on using the changeset viewer.