Results 1 to 6 of 6
I have this command:
Code:
tail -f $TOMCAT/logs/catalina.out | grep "Server startup in"
How can I stopped this when found " Server startup in " ??
thanks in advance...
- 02-10-2010 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
Stopping tail -f when certain string found
I have this command:
How can I stopped this when found "Server startup in" ??Code:tail -f $TOMCAT/logs/catalina.out | grep "Server startup in"
thanks in advance
- 02-10-2010 #2this is kinda crappy as it will echo a line more than once most likely, but it should workCode:
while [ "`tail -n 1 $TOMCAT/logs/catalina.out | grep "Server startup in"`" = "" ] ; do echo `tail -n 1 test` ; done
- 02-10-2010 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
Oh sorry. it's possible that you don't understand my question
In a script I put this:
STOP=`tail -f $TOMCAT/logs/catalina.out | grep "Server startup in"`
if [ "$?" != "0" ]; then
echo ""
else
echo "server start"
fi
I would like that tail detect a Server Start show the echo that I have into the if
- 02-10-2010 #4Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
I think youI can't proceed this way because the -f option of tail prevents it from returning.
You should rather check for the presence of a socket file, if any, that most servers write when they are up,
or check that the port Tomcat listens to is opened or not. See Tomcat's documentation.0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 02-11-2010 #5Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
I try whit this:
I think it's run!Code:tail -f $RUTA_TOMCAT/logs/catalina.out | awk '/Server startup in/; { exit }'
- 02-11-2010 #6Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
You would exit your script without any action done, what's the point ? And I'm not sure all the output of tail would be piped. Does it work as you expect ?
0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.


Reply With Quote