Want to subscribe to topics you're interested in?
Become a Member

Acme.sh cron run error: ambiguous

Discussion in 'Domains, DNS, Email & SSL Certificates' started by pjrobertson, Apr 15, 2021.

  1. pjrobertson

    pjrobertson New Member

    5
    0
    1
    Feb 7, 2021
    Ratings:
    +1
    Local Time:
    10:29 AM
    Hi there,

    I'm having trouble running my acme.sh cert renewal cronjob. The cron is setup correctly, and I can confirm it is running, however I get the following error in my cron log output:

    Code:
    Subject: Cron <root@XXXX> "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /var/log/acme-letsencrypt.log 2>&1:
    Content-Type: text/plain; charset=UTF-8
    Auto-Submitted: auto-generated
    Precedence: bulk
    X-Cron-Env: <XDG_SESSION_ID=37663>
    X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
    X-Cron-Env: <LANG=en_US.UTF-8>
    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <HOME=/root>
    X-Cron-Env: <PATH=/usr/bin:/bin>
    X-Cron-Env: <LOGNAME=root>
    X-Cron-Env: <USER=root>
    Message-Id: <XXXXXX@XXXXX.com>
    Date: Wed, 14 Apr 2021 08:55:01 +0800 (CST)
    Status: O
    
    /bin/sh: 1:: ambiguous redirect
    Running manually from the command line works no problem.

    I originally set up a couple of certs using the following command:

    Code:
    /root/.acme.sh/acme.sh --force --issue --days 60 -d XXX.com -d www.XXX.com -w /home/nginx/domains/XXX.com/public -k 2048 --useragent centminmod-centos-acmesh-webroot --log /root/centminlogs/acmetool.sh-debug-log-XXX.com.log --log-level 2
    
    Also:

    Code:
    # acme.sh --version
    v2.8.9
    
    Thanks for any help

     
  2. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:29 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    how did you install acme.sh as official latest version is 2.8.8 according to acmesh-official/acme.sh and from my servers command
    Code (Text):
    /root/.acme.sh/acme.sh --version
    https://github.com/acmesh-official/acme.sh
    v2.8.8
    

    after running addons/acmetool.sh acmeupdate command
    Code (Text):
    echo y | /usr/local/src/centminmod/addons/acmetool.sh acmeupdate

    looks like 2.8.9 is updated though
    Code (Text):
    /root/.acme.sh/acme.sh --version
    https://github.com/acmesh-official/acme.sh
    v2.8.9
    

    what does cronjob look like in cronjob listing output using command
    Code (Text):
    crontab -l | grep acme

    output should look like
    Code (Text):
    crontab -l | grep acme
    7 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
    

    If you're looking at logging, you can also setup notifications for acme.sh acmesh-official/acme.sh I sent renewal crons to my Slack channel for tracking
     
  3. pjrobertson

    pjrobertson New Member

    5
    0
    1
    Feb 7, 2021
    Ratings:
    +1
    Local Time:
    10:29 AM
    Can't remember how I installed acmetool, but going through bashhistory looks like I used:

    Code:
    /usr/local/src/centminmod/addons/acmetool.sh acmeupdate
    
    Just tried running this and got a warning, not sure if that's an issue:

    Code:
    [17:14][root@XXX.com ~]# echo y | /usr/local/src/centminmod/addons/acmetool.sh acmeupdate
    awk: fatal: cannot open file `/usr/local/nginx/conf/conf.d/virtual.conf' for reading (No such file or directory)
    
    ------------------------------------------------------------------------------
    Version Check:
    ...
    

    Crontab is set up as you show:

    Code:
    [17:17][root@XXXX.com ~]# crontab -l | grep acme
    0 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /var/log/acme-letsencrypt.log 2>&1:
    
    I get the same as you for the version check:

    Code:
    [17:17][root@XXX.com ~]# /root/.acme.sh/acme.sh --version
    https://github.com/acmesh-official/acme.sh
    v2.8.9
    
    I'm stumped as to where this error is coming from :/

    I'll look into notifications/better logging, but it looks like acme won't even run right now.
     
  4. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:29 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    acmetool.sh looks for main hostname nginx vhost virtual.conf too as outlined at Centmin Mod Configuration Files - CentminMod.com LEMP Nginx web stack for CentOS and Getting Started Guide step 1 at Getting Started Guide - CentminMod.com LEMP Nginx web stack for CentOS and expects it to be there but looks like you removed it so addons/acmetool.sh gives that error.

    actually it's different

    mine
    Code (Text):
    7 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
    

    yours
    Code (Text):
    0 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /var/log/acme-letsencrypt.log 2>&1:
    

    try using my version and see
     
  5. pjrobertson

    pjrobertson New Member

    5
    0
    1
    Feb 7, 2021
    Ratings:
    +1
    Local Time:
    10:29 AM
    Are you referring to the

    Code:
    /var/log/acme-letsencrypt.log 2>&1
    
    section? Although now I see that I have a stray colon at the end of my crontab entry. I will alter that and give it a go. Appreciate your help eva2000!
     
  6. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:29 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    yeah that section is what I am referring to
     
  7. pjrobertson

    pjrobertson New Member

    5
    0
    1
    Feb 7, 2021
    Ratings:
    +1
    Local Time:
    10:29 AM
    Right, the stray colon at the end of the crontab entry was the issue.

    Removing that colon (but keeping the logging to /var/log/lestencrypt.log) fixed the issue.

    Thanks again for the help! :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:29 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Thanks for the follow up update! :)