| 
									
										
										
										
											2014-07-26 13:33:26 +04:00
										 |  |  | #!/usr/bin/env watchman | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-15 12:28:17 +03:00
										 |  |  | # For respawn to work, set 'daemon no' in nginx.conf | 
					
						
							|  |  |  | #service_respawn='true' | 
					
						
							| 
									
										
										
										
											2014-07-26 13:33:26 +04:00
										 |  |  | service_command='/usr/bin/nginx' | 
					
						
							|  |  |  | service_pidfile='/run/nginx.pid' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-15 12:22:37 +03:00
										 |  |  | nginx.test_config() { "$service_command" -t "$@"; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | conftest() { | 
					
						
							|  |  |  | 	nginx.test_config | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-07-26 13:33:26 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | reload() { | 
					
						
							| 
									
										
										
										
											2015-09-15 12:25:58 +03:00
										 |  |  | 	if nginx.test_config -q; then | 
					
						
							|  |  |  | 		watchman.reload | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		watchman.err "Nginx config test failed, not reloading." | 
					
						
							|  |  |  | 		return 1 | 
					
						
							|  |  |  | 	fi | 
					
						
							| 
									
										
										
										
											2014-07-26 13:33:26 +04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-24 02:47:40 +04:00
										 |  |  | upgrade() { | 
					
						
							| 
									
										
										
										
											2014-09-30 06:00:16 +04:00
										 |  |  | 	watchman.msg "This script has no zero-downtime upgrade support for nginx." | 
					
						
							| 
									
										
										
										
											2014-09-24 02:47:40 +04:00
										 |  |  | } |