18 lines
		
	
	
		
			519 B
		
	
	
	
		
			Bash
		
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			519 B
		
	
	
	
		
			Bash
		
	
	
	
| #!/bin/bash
 | |
| 
 | |
| function wait_for_process () {
 | |
|     local max_time_wait=30
 | |
|     local process_name="$1"
 | |
|     local waited_sec=0
 | |
|     while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do
 | |
|         log.debug "Process $process_name is not running yet. Retrying in 1 seconds"
 | |
|         log.debug "Waited $waited_sec seconds of $max_time_wait seconds"
 | |
|         sleep 1
 | |
|         ((waited_sec=waited_sec+1))
 | |
|         if ((waited_sec >= max_time_wait)); then
 | |
|             return 1
 | |
|         fi
 | |
|     done
 | |
|     return 0
 | |
| }
 |