質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

Q&A

解決済

2回答

9727閲覧

Let's Encrypt の自動更新のコマンド結果がcommand not foundになる(Apacheで設定)

akkkkin

総合スコア83

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

SSL

SSL(Secure Sockets Layer)とは、暗号化されたプロトコルで、インターネット上での通信セキュリティを提供しています。

0グッド

0クリップ

投稿2017/04/03 06:35

編集2017/04/03 06:53

掲題の件で行き詰っております。

【サーバー情報】
さくらVPS
apache2.4.6
centos7.3.161

【やったこと】
下記のコマンドを入力。

00 05 01 * * /usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd

すると、以下の結果になります。

bash: 00:command not found

コマンドをたたく前に何か設定するものがあるのでしょうか?

ちなみに現在はapacheでLet's Encryptを稼働させている状態です。
(サイト自体もSSLにちゃんとなっている状態)

あと2日で更新が切れます。

【追記】
「00 05 01 * *」も入力しておりました。

改めて
/usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd
で入力したところ、
No such file or directory
と表示されます。

ファイルを確認しても下記のように存在するのですが・・・
cme Dockerfile pep8.travis.sh
certbot Dockerfile-dev README.rst
certbot-apache docs readthedocs.org.requirements.txt
certbot-auto examples setup.cfg
certbot-compatibility-test letsencrypt-auto setup.py
certbot.log letsencrypt-auto-source tests
certbot-nginx letshelp-certbot tools
CHANGES.rst LICENSE.txt tox.cover.sh
CONTRIBUTING.md linter_plugin.py tox.ini
docker-compose.yml MANIFEST.in Vagrantfile

何が原因なのでしょうか?

もし、詳しい方がいらっしゃればご教示いただきたく思います。

何卒よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

00 05 01 * * /usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd
cronに設定する内容のようですが、これをそのままターミナルで入力したということでしょうか?

ターミナルから直接実行するには、以下のように入力し、実行します。
00 05 01 * * の部分はいらない)

/usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd

投稿2017/04/03 06:45

can110

総合スコア38234

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

akkkkin

2017/04/03 06:52

ありがとうございます。 「00 05 01 * *」も入力しておりました。 改めて /usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd で入力したところ、 No such file or directory と表示されます。 ファイルを確認しても下記のように存在するのですが・・・ cme Dockerfile pep8.travis.sh certbot Dockerfile-dev README.rst certbot-apache docs readthedocs.org.requirements.txt certbot-auto examples setup.cfg certbot-compatibility-test letsencrypt-auto setup.py certbot.log letsencrypt-auto-source tests certbot-nginx letshelp-certbot tools CHANGES.rst LICENSE.txt tox.cover.sh CONTRIBUTING.md linter_plugin.py tox.ini docker-compose.yml MANIFEST.in Vagrantfile 何が原因なのでしょうか?
can110

2017/04/03 07:00

cd <certbot-autoのある場所> に移動し ”./certbot-auto --help" なりでヘルプ表示しようとしても同様でしょうか?
akkkkin

2017/04/03 07:21

コメントありがとうございます。 >”./certbot-auto --help" なりでヘルプ表示 下記の結果がかえってきました。 Upgrading certbot-auto 0.10.0 to 0.12.0... Replacing certbot-auto... certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ... Certbot can obtain and install HTTPS/TLS/SSL certificates. By default, it will attempt to use a webserver both for obtaining and installing the cert. The most common SUBCOMMANDS and flags are: obtain, install, and renew certificates: (default) run Obtain & install a cert in your current webserver certonly Obtain or renew a cert, but do not install it renew Renew all previously obtained certs that are near expiry -d DOMAINS Comma-separated list of domains to obtain a cert for --apache Use the Apache plugin for authentication & installation --standalone Run a standalone webserver for authentication --nginx Use the Nginx plugin for authentication & installation --webroot Place files in a server's webroot folder for authentication --manual Obtain certs interactively, or using shell script hooks -n Run non-interactively --test-cert Obtain a test cert from a staging server --dry-run Test "renew" or "certonly" without saving any certs to disk manage certificates: certificates Display information about certs you have from Certbot revoke Revoke a certificate (supply --cert-path) delete Delete a certificate manage your account with Let's Encrypt: register Create a Let's Encrypt ACME account --agree-tos Agree to the ACME server's Subscriber Agreement -m EMAIL Email address for important account notifications More detailed help: -h, --help [TOPIC] print this message, or detailed help on a topic; the available TOPICS are: all, automation, commands, paths, security, testing, or any of the subcommands or plugins (certonly, renew, install, register, nginx, apache, standalone, webroot, etc.)
can110

2017/04/03 07:27

./certbot-auto renew --force-renewal と、先頭に"./"をつけて実行してください。これで動作すると思います。
akkkkin

2017/04/03 07:31

コメントありがとうございます。 コマンド自体は実行されたっぽいですが、何かしらが原因で失敗しているっぽいです。 下記が実行結果です。 ------------------------------------------------------------------------------- Processing /etc/letsencrypt/renewal/hogehoge.com.conf ------------------------------------------------------------------------------- Renewing an existing certificate Performing the following challenges: tls-sni-01 challenge for hogehoge.com Cleaning up challenges Attempting to renew cert from /etc/letsencrypt/renewal/hogehoge.com.conf produced an unexpected error: Could not bind TCP port 443 because it is already in use by another process on this system (such as a web server). Please stop the program in question and then try again.. Skipping. All renewal attempts failed. The following certs could not be renewed: /etc/letsencrypt/live/hogehoge.com/fullchain.pem (failure) 1 renew failure(s), 0 parse failure(s)
can110

2017/04/03 07:36

おそらくApacheが起動しておりport 443が利用されていると思います。 新規取得時と同じくApache停止した状態でcertbot-autoを実行する必要があります。 すでに質問本文の問題とは離れていますので、詳細は別途質問を立てるか、公式手順なりを参照してください。
akkkkin

2017/04/03 07:44

Apacheを停止して実行したところ、うまく実行できました。 ありがとうございます。
can110

2017/04/03 07:46

無事に実行できてよかったです。
guest

0

もしかして、コマンドライン(ターミナル画面の $ の後)に、

00 05 01 * * /usr/local/certbot/certbot-auto renew --force-renewal && /bin/systemctl reload httpd

と打ってますか?

これは cron の設定サンプルで、これを直接打ちこんでも意味がありません。00 をコマンドとみなして解釈しようとして、

bash: 00:command not found

になっています。

とりあえず、急ぎでは

bash

1cd [certbot-auto があるディレクトリ] 2certbot-auto renew --force-renewal 3sudo systemctl restart httpd.service 4 5(※各行ごとに Enter して実行してください)

を打って更新しておきましょう。

その上で cron, crontab について勉強しましょう。

投稿2017/04/03 06:46

編集2017/04/03 06:58
tacsheaven

総合スコア13703

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

akkkkin

2017/04/03 07:18

コメントありがとうございます。 >cd [certbot-auto があるディレクトリ] 上記のディレクトリまでたどりつきました。(lsコマンドで確認) cme Dockerfile pep8.travis.sh certbot Dockerfile-dev README.rst certbot-apache docs readthedocs.org.requirements.txt certbot-auto examples setup.cfg certbot-compatibility-test letsencrypt-auto setup.py certbot.log letsencrypt-auto-source tests certbot-nginx letshelp-certbot tools CHANGES.rst LICENSE.txt tox.cover.sh CONTRIBUTING.md linter_plugin.py tox.ini docker-compose.yml MANIFEST.in Vagrantfile 続いてcertbot-auto renew --force-renewalを実行しましたが下記の結果になります。 bash: certbot-auto: command not found コマンドが認識されていないのでしょうか・・・
tacsheaven

2017/04/03 07:30

パス指定を忘れていました。./certbot-auto と、先頭に ./ を付けて実行してください。 ※sudo の方にはつける必要ないです
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問