]> git.pld-linux.org Git - packages/openssh.git/blob - opensshd.init
- rewrited with new functions
[packages/openssh.git] / opensshd.init
1 #!/bin/sh
2 #
3 # sshd          sshd (secure shell daemon)
4 #
5 # chkconfig:    345 55 45
6 #
7 # description:  sshd (secure shell daemon) is a server part of the ssh suite.
8 #               Ssh can be used for remote login, remote file copying, TCP port
9 #               forwarding etc. Ssh offers strong encryption and authentication.
10
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Get service config
19 [ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd
20
21 # Check that networking is up.
22 if is_no "${NETWORKING}"; then
23         msg_Network_Down OpenSSH
24         exit 1
25 fi
26                         
27
28 # See how we were called.
29 case "$1" in
30   start)
31         # Check if the service is already running?
32         if [ ! -f /var/lock/subsys/sshd ]; then
33                 msg_starting OpenSSH
34                 daemon sshd -h /etc/ssh/ssh_host_key
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd                
37         else
38                 msg_Already_Running OpenSSH
39         fi
40         ;;
41   stop)
42         if [ -f /var/lock/subsys/sshd ]; then
43                 msg_stopping OpenSSH
44                 killproc sshd
45                 rm -f /var/run/sshd.pid /var/lock/subsys/sshd >/dev/null 2>&1
46         else
47                 msg_Not_Running OpenSSH
48                 exit 1
49         fi      
50         ;;
51   restart)
52         $0 stop
53         $0 start
54         ;;
55   status)
56         status sshd
57         exit $?
58         ;;
59   *)
60         msg_Usage "$0 {start|stop|status|restart}"
61         exit 1
62 esac
63
64 exit $RETVAL
This page took 0.035628 seconds and 4 git commands to generate.