#!/bin/ksh

dir=/etc/ssl
domain=www.example.net

/usr/sbin/acme-client $domain
if [ $? -eq 0 ] ; then
	/usr/sbin/ocspcheck -No $dir/$domain.ocsp $dir/$domain.fullchain.pem
	/usr/sbin/rcctl restart relayd
fi

/usr/sbin/ocspcheck -i $dir/$domain.ocsp $dir/$domain.fullchain.pem
if [ $? -eq 1 ] ; then
	/usr/sbin/oscpcheck -No $dir/$domain.ocsp $dir/$domain.fullchain.pem
	/usr/sbin/rcctl restart relayd
fi

exit 0
