[ PHPXref.com ] [ Generated: Sun Jul 20 18:16:01 2008 ] [ ISPConfig 2.2.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> ispconfig_tcpserver (source)

   1  #!/bin/bash
   2  ###############################################################################
   3  # Copyright (c) 2005, projektfarm Gmbh, Till Brehm, Falko Timme
   4  # All rights reserved.
   5  #
   6  # Redistribution and use in source and binary forms, with or without modification,
   7  # are permitted provided that the following conditions are met:
   8  #
   9  #     * Redistributions of source code must retain the above copyright notice,
  10  #       this list of conditions and the following disclaimer.
  11  #     * Redistributions in binary form must reproduce the above copyright notice,
  12  #       this list of conditions and the following disclaimer in the documentation
  13  #       and/or other materials provided with the distribution.
  14  #     * Neither the name of ISPConfig nor the names of its contributors
  15  #       may be used to endorse or promote products derived from this software without
  16  #       specific prior written permission.
  17  #
  18  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21  # IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  22  # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23  # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24  # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  25  # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  26  # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  27  # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28  ###############################################################################
  29  
  30  ###################################
  31  #
  32  # ISPConfig tcpserver-Startscript
  33  #
  34  ###################################
  35  
  36  prog_name="ispconfig_tcpserver"
  37  prog=/home/admispconfig/ispconfig/tools/tcpserver/ispconfig_tcpserver
  38  PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
  39  
  40  RETVAL=0
  41  
  42  start(){
  43      echo -n $"Starting $prog_name"
  44      which ip &> /dev/null
  45      if [ $? != 0 ]; then
  46        OS=`uname -s`
  47        if [ "$OS" == "FreeBSD" ]; then
  48          array=(`ifconfig | grep -iw 'inet' | grep -iv 'inet6' | cut -f2 -d' ' | tr '\n' ' '`)
  49        else
  50          array=(`ifconfig | grep -iw 'inet' | cut -f2 -d: | cut -f1 -d' ' | tr '\n' ' '`)
  51        fi
  52      else
  53        array=(`ip addr show | grep -iw 'inet' | awk '{print $2}' | cut -f1 -d/ | tr '\n' ' '`)
  54      fi
  55      element_count=${#array[@]}
  56      index=0
  57      while [ "$index" -lt "$element_count" ]
  58      do
  59        if [ -f /etc/vsftpd_$array[$index]}.conf ] && [ "$array[$index]}" != "" ];
  60        then
  61          $prog $array[$index]} ftp `which vsftpd` /etc/vsftpd_$array[$index]}.conf &
  62        fi
  63        let "index = $index + 1"
  64      done
  65      RETVAL=$?
  66      echo
  67      return $RETVAL
  68  }
  69  
  70  stop(){
  71      echo -n $"Stopping $prog_name "
  72      array=(`ps ax | grep -iw "$prog" | grep -iv 'grep' | awk '{print $1}' | cut -f1 -d/ | tr '\n' ' '`)
  73      element_count=${#array[@]}
  74      index=0
  75      while [ "$index" -lt "$element_count" ]
  76      do
  77        kill -15 $array[$index]}
  78        let "index = $index + 1"
  79      done
  80  
  81      RETVAL=$?
  82      echo
  83      return $RETVAL
  84  
  85  }
  86  
  87  restart(){
  88      stop
  89      start
  90  }
  91  
  92  
  93  # See how we were called.
  94  case "$1" in
  95      start)
  96          start
  97          ;;
  98      stop)
  99          stop
 100          ;;
 101      restart)
 102          restart
 103          ;;
 104      *)
 105          echo $"Usage: $0 {start|stop|restart}"
 106          RETVAL=1
 107  esac
 108  
 109  exit $RETVAL


[ Powered by PHPXref - Served by Debian GNU/Linux ]