summaryrefslogtreecommitdiff
path: root/package/initramfs/root/etc/init.d/serial
blob: b822f1c2e43dfaea75594808d1ff5ccaeb27546c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

case "$1" in
  start)
  [ -f /usr/local/etc/service.conf ] || exit 0
  # Check that serial service is up.
  grep " *SERIAL *= *no" /usr/local/etc/service.conf && exit 0
  # check that the server is present
  [ -x /sbin/getty ] || exit 0
  echo "Starting Serial console"
  /sbin/getty -L 115200 ttyS00 vt100 &
  touch /var/run/serial.pid
  echo $! > /var/run/serial.pid
  ;;
  stop)
  if [ -f /var/run/serial.pid ]
  then
	kill `cat /var/run/serial.pid`
	rm /var/run/serial.pid
	echo "Serial console killed"
  else
	echo "Serial console not started"
  fi
  ;;
  restart)
  $0 stop
  $0 start
  ;;
  status)
  if [ -f /var/run/serial.pid ]
  then
   inter=`cat /var/run/serial.pid`
   if [ -f /proc/$inter/status ]
   then
   	echo "Serial console running"
   else
   	echo "Serial console not running"
   fi
  else
	echo "Serial console not running"
  fi
  ;;
esac

exit 0