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
42 echo \$\$ > $basedir/$SERVERNAME.pid
43 . $basedir/$SERVERNAME.vars
44 echo "\$(date) starting $SERVERNAME" >> $basedir/$SERVERNAME.log
46 echo \$? > $basedir/$SERVERNAME.status
47 read parent < $basedir/$SERVERNAME.parent.pid
53 trap "exit 1" SIGINT SIGTERM SIGPIPE
54 [ -r $basedir/$SERVERNAME.status
] && {
55 read status
< $basedir/$SERVERNAME.status
56 echo "$(date) samba exited with status $status" >> $basedir/$SERVERNAME.log
59 read pid
< $basedir/$SERVERNAME.pid
60 echo "$(date) Killing samba pid $pid from $$" >> $basedir/$SERVERNAME.log
61 if [ "$pid" = "$$" ]; then
68 rm -f $basedir/$SERVERNAME.status
$basedir/$SERVERNAME.log
69 echo $$
> $basedir/$SERVERNAME.parent.pid
70 trap cleanup SIGINT SIGTERM SIGPIPE
71 screen
-r -X screen
-t test:$SERVERNAME bash
$basedir/$SERVERNAME.launch
72 echo "$(date) waiting in $$" >> $basedir/$SERVERNAME.log
74 echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log
75 read pid
< $basedir/$SERVERNAME.pid
76 echo "$(date) killing $pid" >> $basedir/$SERVERNAME.log
77 kill $pid 2> /dev
/null
78 echo "$(date) exiting" >> $basedir/$SERVERNAME.log