3 export TMPDIR
="$SELFTEST_TMPDIR"
6 [ -z "$SERVERNAME" ] && SERVERNAME
="base"
9 if [ "$osname" = "Linux" ]; then
12 vars
=$
(mktemp
-t tmpsmb
)
16 while [ $dpt -le $end ]; do
23 [ -r $basedir/$SERVERNAME.pid
] && {
24 for i
in $
(seq 2 100); do
25 if [ ! -r "$basedir/${SERVERNAME}-$i.pid" ]; then
26 SERVERNAME
="${SERVERNAME}-$i"
32 rm -f $basedir/$SERVERNAME.
*
34 # set most of the environment vars we have in the screen session too
37 egrep -v '^TERMCAP|^WINDOW|^SHELL|^STY|^SHLVL|^SAMBA_VALGRIND|\$' |
39 sed "s/\(^[^=]*=\)\(.*\)/export \1'\2'/g" > $basedir/$SERVERNAME.vars
41 cat <<EOF > $basedir/$SERVERNAME.launch
43 echo \$\$ > $basedir/$SERVERNAME.pid
44 . $basedir/$SERVERNAME.vars
45 echo "\$(date) starting $SERVERNAME" >> $basedir/$SERVERNAME.log
47 echo \$? > $basedir/$SERVERNAME.status
48 read parent < $basedir/$SERVERNAME.parent.pid
54 trap "exit 1" SIGINT SIGTERM SIGPIPE
55 [ -r $basedir/$SERVERNAME.status
] && {
56 read status
< $basedir/$SERVERNAME.status
57 echo "$(date) samba exited with status $status" >> $basedir/$SERVERNAME.log
60 read pid
< $basedir/$SERVERNAME.pid
61 echo "$(date) Killing samba pid $pid from $$" >> $basedir/$SERVERNAME.log
62 if [ "$pid" = "$$" ]; then
69 rm -f $basedir/$SERVERNAME.status
$basedir/$SERVERNAME.log
70 echo $$
> $basedir/$SERVERNAME.parent.pid
71 trap cleanup SIGINT SIGTERM SIGPIPE
72 screen
-r -X screen
-t test:$SERVERNAME bash
$basedir/$SERVERNAME.launch
73 echo "$(date) waiting in $$" >> $basedir/$SERVERNAME.log
75 echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log
76 read pid
< $basedir/$SERVERNAME.pid
77 echo "$(date) killing $pid" >> $basedir/$SERVERNAME.log
78 kill $pid 2> /dev
/null
79 echo "$(date) exiting" >> $basedir/$SERVERNAME.log