|
113 | 113 | staging_moved=0 |
114 | 114 | is_renew=0 |
115 | 115 | if [ -e "$domain_dir" ]; then |
116 | | - if [ "$staging" = 0 ] && grep -q "acme-staging" "$domain_dir/$main_domain.conf"; then |
| 116 | + if [ "$staging" = 0 ] && [ -e $domain_dir/this_is_staging ]; then |
117 | 117 | mv "$domain_dir" "$domain_dir.staging" |
118 | 118 | mv "$state_dir/private/$main_domain" "$state_dir/private/$main_domain.staging" |
119 | 119 | log info "Certificates are previously issued from a staging server, but staging option is disabled, moved to $domain_dir.staging." |
@@ -180,30 +180,32 @@ get) |
180 | 180 | case $status in |
181 | 181 | 0) |
182 | 182 | link_certs "$domain_dir" "$main_domain" |
183 | | - if [ -e is_renew ]; then |
184 | | - $NOTIFY issued |
185 | | - else |
| 183 | + if [ "$is_renew" = 1 ]; then |
186 | 184 | $NOTIFY renewed |
| 185 | + else |
| 186 | + $NOTIFY issued |
| 187 | + if [ "$staging" = 1 ]; then |
| 188 | + touch $domain_dir/this_is_staging |
| 189 | + fi |
187 | 190 | fi |
188 | 191 | ;; |
189 | 192 | 1) |
190 | | - #server didn't run so don't do anything |
| 193 | + #cert is not due to renewl so don't do anything |
191 | 194 | if [ "$staging_moved" = 1 ]; then |
192 | 195 | log err "Staging certificate '$domain_dir' restored" |
193 | 196 | mv "$domain_dir.staging" "$domain_dir" |
194 | | - log err "Staging certificate restored" |
195 | 197 | fi |
196 | 198 | log debug "not due to renewal" |
197 | 199 | ;; |
198 | 200 | *) |
199 | | - if [ -e is_renew ]; then |
| 201 | + if [ "$is_renew" = 1 ]; then |
200 | 202 | $NOTIFY renew-failed |
201 | 203 | exit 1; |
202 | 204 | fi |
203 | 205 | if [ "$staging_moved" = 1 ]; then |
204 | 206 | log err "Staging certificate '$domain_dir' restored" |
205 | 207 | mv "$domain_dir.staging" "$domain_dir" |
206 | | - log err "Staging certificate restored" |
| 208 | + mv "$state_dir/private/$main_domain.staging" "$state_dir/private/$main_domain" |
207 | 209 | elif [ -d "$domain_dir" ]; then |
208 | 210 | failed_dir="$domain_dir.failed-$(date +%s)" |
209 | 211 | mv "$domain_dir" "$failed_dir" |
|
0 commit comments