3 export TMPDIR
="$SELFTEST_TMPDIR"
6 [ -z "$SERVERNAME" ] && SERVERNAME
="base"
9 [ -r $basedir/$SERVERNAME.pid
] && {
11 if [ ! -r "$basedir/${SERVERNAME}-$i.pid" ]; then
12 SERVERNAME
="${SERVERNAME}-$i"
18 rm -f $basedir/$SERVERNAME.
{launch
,log
,parent.pid
,pid
,status
}
20 # set most of the environment vars we have in the screen session too
23 egrep -v '^TERMCAP|^WINDOW|^SHELL|^STY|^SHLVL|^SAMBA_VALGRIND|\$' |
25 sed "s/\(^[^=]*=\)\(.*\)/export \1'\2'/g" > $basedir/$SERVERNAME.vars
27 cat <<EOF > $basedir/$SERVERNAME.launch
29 echo \$\$ > $basedir/$SERVERNAME.pid
30 . $basedir/$SERVERNAME.vars
31 echo "\$(date) starting $SERVERNAME" >> $basedir/$SERVERNAME.log
33 echo \$? > $basedir/$SERVERNAME.status
34 read parent < $basedir/$SERVERNAME.parent.pid
40 trap "exit 1" SIGINT SIGTERM SIGPIPE
41 [ -r $basedir/$SERVERNAME.status
] && {
42 read status
< $basedir/$SERVERNAME.status
43 echo "$(date) samba exited with status $status" >> $basedir/$SERVERNAME.log
48 *.nmbd|
*.smbd|
*.winbindd|
*.samba
)
49 kill $
(cat $basedir/..
/"${ENVNAME%\.*}"/pid
/"${ENVNAME##*\.}".pid
)
53 read pid
< $basedir/$SERVERNAME.pid
54 echo "$(date) Killing samba pid $pid from $$" >> $basedir/$SERVERNAME.log
55 if [ "$pid" = "$$" ]; then
62 echo $$
> $basedir/$SERVERNAME.parent.pid
63 trap cleanup SIGINT SIGTERM SIGPIPE
65 if [[ "$TMUX" ]]; then
67 if [[ $TMUX = *tmate
* ]]; then
71 $TMUX_CMD new-window
-n test:$SERVERNAME "bash $basedir/$SERVERNAME.launch"
73 # tmux seems to lag a bit for new sessions. Don't create them too
74 # quickly one after another
77 screen
-r -X screen
-t test:$SERVERNAME bash
$basedir/$SERVERNAME.launch
79 echo "$(date) waiting in $$" >> $basedir/$SERVERNAME.log
81 echo "$(date) EOF on stdin" >> $basedir/$SERVERNAME.log
84 *.nmbd|
*.smbd|
*.winbindd|
*.samba
)
85 kill $
(cat $basedir/..
/"${ENVNAME%\.*}"/pid
/"${ENVNAME##*\.}".pid
)
89 read pid
< $basedir/$SERVERNAME.pid
90 echo "$(date) killing $pid" >> $basedir/$SERVERNAME.log
91 kill $pid 2> /dev
/null
92 echo "$(date) exiting" >> $basedir/$SERVERNAME.log