Skip to content

Commit

Permalink
security/acme.sh: fix post-install script
Browse files Browse the repository at this point in the history
The install script contained a syntax error which caused the log file
to not be created.

While here:

* rename script from pkg-install to pkg-post-install
* include another crontab example which provides additional contet to
  logging.

PR:		274348
  • Loading branch information
dlangille committed Oct 8, 2023
1 parent 4881ece commit 678db80
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions security/acme.sh/Makefile
@@ -1,5 +1,6 @@
PORTNAME= acme.sh
PORTVERSION= 3.0.7
PORTREVISION= 1
CATEGORIES= security

MAINTAINER= dvl@FreeBSD.org
Expand Down
24 changes: 21 additions & 3 deletions security/acme.sh/files/acme-crontab.in
@@ -1,12 +1,30 @@
#
# This file should be copied to /usr/local/etc/cron.d/acme
# This file should be copied to %%PREFIX%%/etc/cron.d/acme

# use /bin/sh to run commands, overriding the default set by cron
#SHELL=/bin/sh

# mail any output to here, no matter whose crontab this is
#MAILTO=me@example.org

# set mm and hh to the time (e.g. hh:mm) of day you want the
# cronjob to run
# uncomment, set mm and hh to the time (e.g. hh:mm) of day you want the
# cronjob to run - pick one of the following and enable it. Running more
# than one won't hurt, but you should avoid running them concurrently.
#
# the lockf ensures only one runs at a time if for some reason it never completes.
# I tend to do this for most cronjobs.


# This will send only errors to your email, everything else goes to /dev/null
# I find it lacks context.
mm hh * * * %%ACME_USER%% %%PREFIX%%/sbin/acme.sh --cron --home /var/db/acme/.acme.sh > /dev/null

#
# This dumps STDERR and STDOUT to a file and should never generate an email.
# The resulting log file shows any errors in context, which I found more useful for debugging.
# I set this file to rotate daily, since the cronjob also runs daily.
# I still get email if something goes wrong, via the SAVED_MAIL_FROM and
# SAVED_MAIL_TO options in account.conf - I also use NOTIFY_HOOK='pushover,mail'
# which requires setting SAVED_PUSHOVER_TOKEN and SAVED_PUSHOVER_USER.
#
mm hh * * * %%ACME_USER%% /usr/bin/lockf -t 0 /tmp/.acme.sh.cronjob %%PREFIX%%/sbin/acme.sh --cron --home /var/db/acme/.acme.sh > /var/log/acme.sh.cronjob.log 2>&1
11 changes: 0 additions & 11 deletions security/acme.sh/pkg-install

This file was deleted.

7 changes: 7 additions & 0 deletions security/acme.sh/pkg-post-install
@@ -0,0 +1,7 @@
#!/bin/sh

# create the log file, if it does not exist
if [ ! -f /var/log/acme.sh.log ]
then
/usr/bin/install -C -m 640 -o acme -g acme /dev/null /var/log/acme.sh.log
fi

0 comments on commit 678db80

Please sign in to comment.