975541c7409a15a07f17bfdaf94f0de47061c463
Linux/Apache/mod_ssl.md
... | ... | @@ -351,35 +351,33 @@ Kcertbot-key.+165+43987.key, Kcertbot-key.+165+43987.private の2つのファ |
351 | 351 | -d "*.<ドメイン>" -d <ドメイン>
|
352 | 352 | ```
|
353 | 353 | |
354 | -- /etc/cron.weekly/renewCert.sh
|
|
354 | +- /etc/letsencrypt/renewal-hooks/deploy/restartServices.sh
|
|
355 | 355 | ```bash
|
356 | 356 | #!/bin/bash
|
357 | 357 | |
358 | 358 | LANG=en_us.UTF-8
|
359 | 359 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
|
360 | -dir_letsencrypt=/etc/letsencrypt/live/
|
|
361 | 360 | services="httpd postfix dovecot"
|
362 | 361 | |
363 | -check_update() {
|
|
364 | - dir=$1
|
|
365 | - [ $(find ${dir} -mtime -1 -print | wc -l) -gt 1 ]
|
|
366 | -}
|
|
367 | -
|
|
368 | 362 | if [ $(id -u) != 0 ]; then
|
369 | 363 | echo "This command requires root previlege." 1>&2
|
370 | 364 | exit 1
|
371 | 365 | fi
|
372 | 366 | |
373 | -certbot renew
|
|
374 | -if check_update ${dir_letsencrypt}; then
|
|
375 | - for service in ${services}; do
|
|
376 | - echo "restart ${service}"
|
|
377 | - systemctl restart ${service} || exit $?
|
|
378 | - done
|
|
379 | -fi
|
|
367 | +for service in ${services}; do
|
|
368 | + echo "restart ${service}"
|
|
369 | + systemctl restart ${service} || exit $?
|
|
370 | +done
|
|
380 | 371 | exit 0
|
381 | 372 | ```
|
382 | 373 | |
374 | +- サービス登録
|
|
375 | +```
|
|
376 | +# systemctl start certbot-renew
|
|
377 | +# systemctl enable certbot-renew
|
|
378 | +# systemctl status certbot-renew
|
|
379 | +```
|
|
380 | +
|
|
383 | 381 | # 動作確認
|
384 | 382 | |
385 | 383 | ## 証明書の内容をテキスト出力
|