/usr/sbin/startsrv is in remote-tty 4.0-13build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #!/bin/sh
# $Id: startsrv.sh,v 1.10 2001/03/24 21:17:40 vixie Exp $
# Copyright (c) 1996 by Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
default_options='-b 9600 -w 8 -p none'
default_sock_prot='ug=rw,o='
default_sock_owner='rttymgr:dialout'
default_log_prot='u=rw,g=r,o='
for host
do
echo -n "startsrv($host):"
#
# kill any existing ttysrv on this port
#
if [ -f /var/run/remote-tty/pid/$host ]; then
pid=`cat /var/run/remote-tty/pid/$host`
tmpfile=`mktemp -t`
while ps w$pid >$tmpfile 2>&1
do
grep -q ttysrv $tmpfile && {
echo -n " $pid killed"
kill $pid
sleep 1
} || {
break
}
done
rm /var/run/remote-tty/pid/$host $tmpfile
fi
#
# start up a new one
#
if [ -s /etc/remote-tty/opt/${host}.srv ]; then
options=`cat /etc/remote-tty/opt/${host}.srv`
elif [ -s /etc/remote-tty/opt/DEFAULT.srv ]; then
options=`cat /etc/remote-tty/opt/DEFAULT.srv`
else
options="$default_options"
fi
if [ -s /etc/remote-tty/prot/${host}.sock ]; then
sock_prot=`cat /etc/remote-tty/prot/${host}.sock`
elif [ -s /etc/remote-tty/prot/DEFAULT.sock ]; then
sock_prot=`cat /etc/remote-tty/prot/DEFAULT.sock`
else
sock_prot="$default_sock_prot"
fi
if [ -s /etc/remote-tty/owner/${host}.sock ]; then
sock_owner=`cat /etc/remote-tty/owner/${host}.sock`
elif [ -s /etc/remote-tty/owner/DEFAULT.sock ]; then
sock_owner=`cat /etc/remote-tty/owner/DEFAULT.sock`
else
sock_owner="$default_sock_owner"
fi
if [ -s /etc/remote-tty/prot/${host}.log ]; then
log_prot=`cat /etc/remote-tty/prot/${host}.log`
elif [ -s /etc/remote-tty/prot/DEFAULT.log ]; then
log_prot=`cat /etc/remote-tty/prot/DEFAULT.log`
else
log_prot="$default_log_prot"
fi
rm -f /var/run/remote-tty/sock/$host /var/run/remote-tty/pid/$host
/usr/sbin/ttysrv $options \
-t /etc/remote-tty/dev/$host \
-s /var/run/remote-tty/sock/$host \
-l /var/log/remote-tty/$host/$host \
-i /var/run/remote-tty/pid/$host \
> /var/log/remote-tty/out/$host 2>&1 &
echo -n " "
tries=5
while [ $tries -gt 0 -a ! -f /var/run/remote-tty/pid/$host ]; do
echo -n "."
sleep 1
tries=`expr $tries - 1`
done
if [ ! -f /var/run/remote-tty/pid/$host ]; then
echo " [startup failed]"
else
newpid=`cat /var/run/remote-tty/pid/$host`
chmod $sock_prot /var/run/remote-tty/sock/$host
chown $sock_owner /var/run/remote-tty/sock/$host
chmod $log_prot /var/log/remote-tty/$host/$host
echo " $newpid started"
fi
done
exit
|