source: clfs-embedded/bootscripts/clfs/etc/rc.d/init.d/sshd@ a44b91b

Last change on this file since a44b91b was a44b91b, checked in by Jim Gifford <clfs@…>, 18 years ago

Added CLFS 3.x bootscripts

  • Property mode set to 100755
File size: 1.0 KB
Line 
1#!/bin/ash
2#
3# DropBear SSH
4
5. /etc/rc.d/init.d/functions
6
7PATH=/bin:/sbin:/usr/bin:/usr/sbin
8
9DSSKEY=/etc/ssh/dss_host_key
10RSAKEY=/etc/ssh/rsa_host_key
11
12case "$1" in
13start)
14 if [ ! -r "$DSSKEY" ]; then
15 echo -n "Generating DSS host key: "
16 dropbearkey -t dss -f "$DSSKEY" &> /dev/null
17 check_status
18 fi
19 if [ ! -r "$RSAKEY" ]; then
20 echo -n "Generating RSA host key: "
21 dropbearkey -t rsa -f "$RSAKEY" &> /dev/null
22 check_status
23 fi
24 if [ -r /var/run/dropbear.pid ]; then
25 echo "Service sshd already running."
26 else
27 echo -n "Starting SSH server: "
28 dropbear
29 check_status
30 fi
31 ;;
32stop)
33 if [ -r /var/run/dropbear.pid ]; then
34 echo -n "Stopping SSH server: "
35 kill `cat /var/run/dropbear.pid`
36 check_status
37 else
38 echo "Service sshd not running."
39 fi
40 ;;
41restart)
42 $0 stop
43 $0 start
44 ;;
45status)
46 if [ -r /var/run/dropbear.pid ]; then
47 echo "Service sshd running (PID `cat /var/run/dropbear.pid`)."
48 else
49 echo "Service sshd not running."
50 fi
51 ;;
52*)
53 echo "Usage: $0 {start|stop|restart|status}"
54 exit 1
55esac
Note: See TracBrowser for help on using the repository browser.