Fix shell_module executable and mail healthcheck
This commit is contained in:
		
							parent
							
								
									0c60e974a2
								
							
						
					
					
						commit
						36c12a330f
					
				
					 4 changed files with 23 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -9,9 +9,21 @@ alias curl_hc='curl -LA "$USER_AGENT" --retry 3'
 | 
			
		|||
envsubst < template.msmtprc > /tmp/msmtprc
 | 
			
		||||
envsubst < mailcheck.template.mail > /tmp/mailcheck.mail
 | 
			
		||||
 | 
			
		||||
result=$(msmtp -C /tmp/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /tmp/mailcheck.mail 2>&1)
 | 
			
		||||
if [ "$?" != "0" ]
 | 
			
		||||
then
 | 
			
		||||
	echo "$result"
 | 
			
		||||
	curl_hc --data-raw "$result" "$hc_url/fail" >/dev/null
 | 
			
		||||
fi
 | 
			
		||||
# Retry 3 times
 | 
			
		||||
for i in 1 2 3
 | 
			
		||||
do
 | 
			
		||||
	result=$(msmtp -C /tmp/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /tmp/mailcheck.mail 2>&1)
 | 
			
		||||
	if [ "$?" = "0" ]
 | 
			
		||||
	then
 | 
			
		||||
		exit 0
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ $i -eq 3 ]
 | 
			
		||||
	then
 | 
			
		||||
		echo "$result"
 | 
			
		||||
		curl_hc --data-raw "$result" "$hc_url/fail" >/dev/null
 | 
			
		||||
		exit 1
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	sleep 3
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue