Renewing: unable to find renew-hook


#1

Hi friends,
On Debian Jessie, and using certbot 0.8.1-2~bpo8+1, running the renew command by cron:

0 0 * * * /usr/bin/certbot renew --quiet --renew-hook "service apache2 reload"

Obtain on root email this message:

From root@server.sio4.org  Sun Nov  6 00:00:07 2016
Return-Path: <root@server.sio4.org>
X-Original-To: root
Delivered-To: root@server.sio4.org
Received: by server.sio4.org (Postfix, from userid 0)
        id 3F68B40BA2; Sun,  6 Nov 2016 00:00:07 +0100 (CET)
From: root@server.sio4.org (Cron Daemon)
To: root@server.sio4.org
Subject: Cron <root@server> /usr/bin/certbot renew --quiet --renew-hook "service apache2 reload"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20161105230007.3F68B40BA2@server.sio4.org>
Date: Sun,  6 Nov 2016 00:00:07 +0100 (CET)

Unable to find renew-hook command service in the PATH.

Where:

Unable to find renew-hook command service in the PATH.
(PATH is /usr/bin:/bin)

worries me. Why this message? :grimacing:

Many many thanks!


#2

Hello @danjde,

service command is located on /usr/sbin/ so you should add that dir to PATH var on crontab or specify the full path on your command line.

0 0 * * * /usr/bin/certbot renew --quiet --renew-hook "/usr/sbin/service apache2 reload"

Cheers,
sahsanu


#3

The PATH environment variable is different between the user you’re using with SSH et c. and the user cron is running as.


#4

Very thanks to all!
Now is clear for me too :innocent:

Thanks again!


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.