"Fossies" - the Fresh Open Source Software Archive

Member "LinOTP-release-2.11/linotpd/src/config/linotp2-paster" (12 Nov 2019, 2590 Bytes) of package /linux/misc/LinOTP-release-2.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 ### BEGIN INIT INFO
    3 # Provides:          linotp2-paster
    4 # Required-Start:    $remote_fs   
    5 # Required-Stop:     $remote_fs
    6 # Default-Start:     2 3 4 5
    7 # Default-Stop:      0 1 6
    8 # Short-Description: Start LinOTP2 daemon at boot time
    9 # Description:       LinOTP2 provides one time password authentication for many different services
   10 ### END INIT INFO
   11 #
   12 # LinOTP2 Startup script for the LinOTP2 Pylons app
   13 #
   14 # chkconfig: - 90 15
   15 # description: LinOTP2 is a Pylons-based web application.
   16 
   17 # Source Red Hat function library.
   18 if [ -f /etc/rc.d/init.d/functions ]; then
   19 . /etc/rc.d/init.d/functions
   20 fi
   21 
   22 RETVAL=0
   23 DESC=linotp
   24 APP_PATH=/etc/linotp2
   25 PYTHON=/usr/bin/python
   26 PASTER=/usr/bin/paster
   27 CONFIG=/etc/linotp2/linotp.ini
   28 USER=linotp
   29 GROUP=users
   30 LOG_FILE=/var/log/linotp/linotp.log
   31 PID_FILE=/var/run/linotp/linotp.pid
   32 LOCK_FILE=/var/run/linotp/linotp.lock
   33 
   34 OPTIONS=" serve -q --daemon \
   35 --user=$USER \
   36 --group=$GROUP \
   37 --log-file=$LOG_FILE \
   38 --pid-file=$PID_FILE \
   39 $CONFIG"
   40 
   41 start() {
   42         echo -n $"Starting $DESC: "
   43         status
   44                 if [[ $STATUS =~ 'Server running' ]]
   45                 then
   46                         # if already started, echo paster status
   47                         echo $STATUS
   48                 else
   49             mkdir -p /var/run/linotp
   50             chown $USER /var/run/linotp
   51                         cd $APP_PATH
   52                         #daemon $PYTHON $PASTER $OPTIONS
   53                         $PYTHON $PASTER $OPTIONS
   54             
   55                         RETVAL=$?
   56                         echo
   57                         [ $RETVAL = 0 ] && touch $LOCK_FILE
   58                         return $RETVAL
   59                 fi
   60 }
   61 
   62 stop() {
   63         echo -n $"Stopping $DESC: "
   64         status
   65                 if [[ $STATUS =~ 'No PID' ]]
   66                 then
   67                         # if already stopped, echo paster status
   68                         echo $STATUS
   69                 else
   70                         cd $APP_PATH
   71                         $PYTHON $PASTER serve --stop-daemon --pid-file=$PID_FILE
   72                         RETVAL=$?
   73                         [ $RETVAL = 0 ] && rm -f $LOCK_FILE
   74                         echo
   75                 fi
   76 }
   77 
   78 status() {
   79         cd $APP_PATH
   80         STATUS=`$PYTHON $PASTER serve --status --pid-file=$PID_FILE $CONFIG`
   81 }
   82 
   83 case "$1" in
   84   start)
   85         start
   86         ;;
   87   stop)
   88         stop
   89         ;;
   90   status)
   91         status
   92         echo $STATUS
   93         ;;
   94   restart|reload|force-reload)
   95         stop
   96         start
   97         ;;
   98   *)
   99         N=/etc/init.d/$DESC
  100         echo "Usage: $0 {start|stop|status|restart}" >&2
  101         exit 1
  102         ;;
  103 esac
  104 
  105 exit 0
  106