~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/remote-tty

  • Committer: Dimitri John Ledkov
  • Date: 2014-05-06 18:45:46 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140506184546-5toyx56xxrue0f0v
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
### BEGIN INIT INFO
 
4
# Provides:          remote-tty
 
5
# Required-Start:    $remote_fs $syslog
 
6
# Required-Stop:     $remote_fs $syslog
 
7
# Should-Start:      $local_fs
 
8
# Should-Stop:       $local_fs
 
9
# Default-Start:     2 3 4 5
 
10
# Default-Stop:      0 1 6
 
11
# Short-Description: Start the remote-tty serial console manager
 
12
# Description:       This starts remote-tty listening and logging
 
13
#                    on all of its configured serial ports.
 
14
### END INIT INFO
 
15
 
 
16
set -e
 
17
 
 
18
test -x /usr/sbin/ttysrv || exit 0
 
19
 
 
20
case "$1" in
 
21
  start)
 
22
        echo "Starting remote-tty console manager:"
 
23
        mkdir -p /var/run/remote-tty/sock
 
24
        mkdir -p /var/run/remote-tty/pid
 
25
        chmod -R 775 /var/run/remote-tty
 
26
        chown -R rttymgr:rttymgr /var/run/remote-tty >/dev/null 2>&1 || true
 
27
 
 
28
        cd /etc/remote-tty/dev
 
29
        if [ ! "x`ls`" = x ]; then
 
30
                su rttymgr -c "/usr/sbin/startsrv *"
 
31
        else
 
32
                echo "  no consoles configured"
 
33
        fi
 
34
        ;;
 
35
  stop)
 
36
        echo -n "Stopping remote-tty console manager:"
 
37
        cd /var/run/remote-tty/pid
 
38
        for i in *; do
 
39
                if [ -f $i ]; then
 
40
                        echo -n " $i"
 
41
                        if start-stop-daemon --stop --quiet --oknodo \
 
42
                                        --pidfile /var/run/remote-tty/pid/$i;
 
43
                                        then
 
44
                                rm -f $i
 
45
                                rm -f /var/run/remote-tty/sock/$i
 
46
                        fi
 
47
                else
 
48
                        echo -n " nothing running"
 
49
                fi
 
50
        done
 
51
        echo "."
 
52
        ;;
 
53
  restart|force-reload)
 
54
        sh $0 stop
 
55
        sleep 5
 
56
        sh $0 start
 
57
        ;;
 
58
  *)
 
59
        echo "Usage: /etc/init.d/$(basename $0) {start|stop}"
 
60
        exit 1
 
61
esac
 
62
 
 
63
exit 0