]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/sshd
OpenVPN converter: Fix coding style and verbose output.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / sshd
CommitLineData
23104841
MT
1#!/bin/sh
2# Begin $rc_base/init.d/sshd
3
4# Based on sysklogd script from LFS-3.1 and earlier.
5# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
6
7#$LastChangedBy: bdubbs $
8#$Date: 2006-04-15 17:34:16 -0500 (Sat, 15 Apr 2006) $
9
10. /etc/sysconfig/rc
11. $rc_functions
12
13case "$1" in
14 start)
c81e9e43
CS
15 if [ ! -e /etc/ssh/ssh_host_rsa_key ]; then
16 echo "Generating SSH Keys"
17 ssh-keygen -qf /etc/ssh/ssh_host_rsa_key -N ''
18 ssh-keygen -qf /etc/ssh/ssh_host_key -N '' -t rsa1
19 ssh-keygen -qf /etc/ssh/ssh_host_dsa_key -N '' -t dsa
abcbbd1f 20 ssh-keygen -qf /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
c81e9e43
CS
21 fi
22
23 [ -e "/var/ipfire/remote/enablessh" ] || exit 0 # SSH is not enabled
23104841
MT
24 boot_mesg "Starting SSH Server..."
25 # Also prevent ssh from being killed by out of memory conditions
26 loadproc /usr/sbin/sshd
cb5e9c6c 27 sleep 3
23104841
MT
28 echo "-16" >/proc/`cat /var/run/sshd.pid`/oom_adj
29 ;;
30
31 stop)
32 boot_mesg "Stopping SSH Server..."
33 killproc /usr/sbin/sshd
34 ;;
35
36 reload)
37 boot_mesg "Reloading SSH Server..."
38 reloadproc /usr/sbin/sshd
39 ;;
40
41 restart)
42 $0 stop
43 sleep 1
44 $0 start
45 ;;
46
47 status)
48 statusproc /usr/sbin/sshd
49 ;;
50
51 *)
52 echo "Usage: $0 {start|stop|reload|restart|status}"
53 exit 1
54 ;;
55esac
56
57# End $rc_base/init.d/sshd