"Fossies" - the Fresh Open Source Software Archive

Member "sshdfilter-1.5.7/etc/init.d/sshd.su10rc1" (3 Jun 2006, 3691 Bytes) of package /linux/privat/old/sshdfilter-1.5.7.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 and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
    3 #
    4 # Author: Jiri Smid <feedback@suse.de>
    5 #
    6 # /etc/init.d/sshd
    7 #
    8 #   and symbolic its link
    9 #
   10 # /usr/sbin/rcsshd
   11 #
   12 ### BEGIN INIT INFO
   13 # Provides: sshd
   14 # Required-Start: $network $remote_fs
   15 # Required-Stop: $network $remote_fs
   16 # Default-Start: 3 5
   17 # Default-Stop: 0 1 2 6
   18 # Description: Start the sshd daemon
   19 ### END INIT INFO
   20 
   21 SSHD_BIN=/usr/sbin/sshd
   22 test -x $SSHD_BIN || exit 5
   23 
   24 SSHD_SYSCONFIG=/etc/sysconfig/ssh
   25 test -r $SSHD_SYSCONFIG || exit 6
   26 . $SSHD_SYSCONFIG
   27 
   28 SSHD_PIDFILE=/var/run/sshd.init.pid
   29 
   30 . /etc/rc.status
   31 
   32 # Shell functions sourced from /etc/rc.status:
   33 #      rc_check         check and set local and overall rc status
   34 #      rc_status        check and set local and overall rc status
   35 #      rc_status -v     ditto but be verbose in local rc status
   36 #      rc_status -v -r  ditto and clear the local rc status
   37 #      rc_failed        set local and overall rc status to failed
   38 #      rc_reset         clear local rc status (overall remains)
   39 #      rc_exit          exit appropriate to overall rc status
   40 
   41 # First reset status of this service
   42 rc_reset
   43 
   44 case "$1" in
   45     start)
   46         if ! test -f /etc/ssh/ssh_host_key ; then
   47         echo Generating /etc/ssh/ssh_host_key.
   48         ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
   49         fi
   50         if ! test -f /etc/ssh/ssh_host_dsa_key ; then
   51         echo Generating /etc/ssh/ssh_host_dsa_key.
   52         
   53         ssh-keygen -t dsa -b 1024 -f /etc/ssh/ssh_host_dsa_key -N ''
   54         fi
   55         if ! test -f /etc/ssh/ssh_host_rsa_key ; then
   56         echo Generating /etc/ssh/ssh_host_rsa_key.
   57         
   58         ssh-keygen -t rsa -b 1024 -f /etc/ssh/ssh_host_rsa_key -N ''
   59         fi
   60     echo -n "Starting SSH daemon"
   61     ## Start daemon with startproc(8). If this fails
   62     ## the echo return value is set appropriate.
   63 
   64     startproc -f -p $SSHD_PIDFILE /usr/local/sbin/sshdfilter $SSHD_OPTS -o "PidFile=$SSHD_PIDFILE" 
   65 
   66     # Remember status and be verbose
   67     rc_status -v
   68     ;;
   69     stop)
   70     echo -n "Shutting down SSH daemon"
   71     ## Stop daemon with killproc(8) and if this fails
   72     ## set echo the echo return value.
   73 
   74     killproc -p $SSHD_PIDFILE -TERM /usr/sbin/sshd
   75 
   76     # Remember status and be verbose
   77     rc_status -v
   78     ;;
   79     try-restart)
   80         ## Stop the service and if this succeeds (i.e. the 
   81         ## service was running before), start it again.
   82         $0 status >/dev/null &&  $0 restart
   83 
   84         # Remember status and be quiet
   85         rc_status
   86         ;;
   87     restart)
   88         ## Stop the service and regardless of whether it was
   89         ## running or not, start it again.
   90         $0 stop
   91         $0 start
   92 
   93         # Remember status and be quiet
   94         rc_status
   95         ;;
   96     force-reload|reload)
   97     ## Signal the daemon to reload its config. Most daemons
   98     ## do this on signal 1 (SIGHUP).
   99 
  100     echo -n "Reload service sshd"
  101 
  102     killproc -p $SSHD_PIDFILE -HUP /usr/sbin/sshd
  103 
  104         rc_status -v
  105 
  106         ;;
  107     status)
  108     echo -n "Checking for service sshd "
  109         ## Check status with checkproc(8), if process is running
  110         ## checkproc will return with exit status 0.
  111 
  112         # Status has a slightly different for the status command:
  113         # 0 - service running
  114         # 1 - service dead, but /var/run/  pid  file exists
  115         # 2 - service dead, but /var/lock/ lock file exists
  116         # 3 - service not running
  117 
  118     checkproc -p $SSHD_PIDFILE /usr/sbin/sshd
  119 
  120     rc_status -v
  121     ;;
  122     probe)
  123     ## Optional: Probe for the necessity of a reload,
  124     ## give out the argument which is required for a reload.
  125 
  126         test /etc/ssh/sshd_config -nt $SSHD_PIDFILE && echo reload
  127     ;;
  128     *)
  129     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  130     exit 1
  131     ;;
  132 esac
  133 rc_exit