source: bootscripts-standard/bootscripts/cblfs/init.d/sshd@ 56f753d

Last change on this file since 56f753d was 2167cfe, checked in by William Harrington <kb0iic@…>, 10 years ago

bootscripts are the scripts used for the sysvinit book.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#!/bin/bash
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
13pidfile=/var/run/sshd.pid
14
15case "$1" in
16 start)
17 if [ ! -f /etc/ssh/ssh_host_key ]; then
18 boot_mesg "Generating /etc/ssh/ssh_host_key"
19 ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ""
20 evaluate_retval
21 fi
22 if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
23 boot_mesg "Generating /etc/ssh/ssh_host_dsa_key"
24 ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
25 evaluate_retval
26 fi
27 if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
28 boot_mesg "Generating /etc/ssh/ssh_host_rsa_key"
29 ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
30 evaluate_retval
31 fi
32
33 boot_mesg "Starting SSH Server..."
34 # Also prevent ssh from being killed by out of memory conditions
35 loadproc -p $pidfile /usr/sbin/sshd
36 sleep 1
37 echo "-16" >/proc/`cat $pidfile`/oom_adj
38 ;;
39
40 stop)
41 boot_mesg "Stopping SSH Server..."
42 killproc -p $pidfile /usr/sbin/sshd
43 ;;
44
45 reload)
46 boot_mesg "Reloading SSH Server..."
47 reloadproc -p $pidfile /usr/sbin/sshd
48 ;;
49
50 restart)
51 $0 stop
52 sleep 1
53 $0 start
54 ;;
55
56 status)
57 statusproc -p $pidfile /usr/sbin/sshd
58 ;;
59
60 *)
61 echo "Usage: $0 {start|stop|reload|restart|status}"
62 exit 1
63 ;;
64esac
65
66# End $rc_base/init.d/sshd
Note: See TracBrowser for help on using the repository browser.