for loop instance
query whether the tomcat process exists in 5 seconds interval, if there is out of the loop, loop at most 20 times, wait 100 seconds
for i in $(seq 1 20); do ps aux| grep tomcat | grep -v grep && break;sleep 5;done
while loop instance
query whether the tomcat process exists, if there is out of the loop, if not will wait
while true; do ps aux | grep tomcat | grep -v grep && break;sleep 5; done
p>
p>
div>
Read More:
- In Linux shell script, about the commonly used flag [- EQ, GT..] in test and if judgment
- Shell script: syntax error: bad for loop variable error resolution
- Several methods of executing multiple commands in Linux shell
- Linux shell RM deletes all. O suffix files in the subdirectory
- Linux’s method of clearing DNS cache and refreshing DNS in shell terminal (Ubuntu, Debian)
- ‘break’ not in the ‘loop’ or ‘switch’ context Error (Fixed)
- An undetermined call to function ‘shell’: missing ‘. Stop. Problem encountered when using shell command in makefile
- Linux shell gets the file name under the folder
- Removing duplicate lines from Linux shell files
- error: ‘for‘ loop initial declarations are only allowed in C99 mode
- Solution to the error $’\ R’: command not found when executing shell script under Linux
- Linux command line cursor moving skills
- How to handle when select single is not allowed in loop
- Compiler problem, error: ‘for’ loop initial declarations are only allowed in C99 mode
- Three ways of single line and multi line comment in Python
- How to Fix error: ‘for’ loop initial declarations are only allowed in C99 mode
- The method of Java jumping out of loop
- The solution of “error in NLS loop more than 50” in R language
- How to terminate the current program under linux command line?
- Solution: error in the RPC receive loop