2

I'm trying to add cron task to renew my certbot certificates everytime they are going to expire, but I can't seem to be able to do that. I used this command: crontab -e 0 12 * * * /usr/bin/certbot renew -quiet

crontab: invalid option -- 'q'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

Also tried this: rontab -e 0 12 * * * /usr/bin/certbot renew --quiet And got:

crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

This: crontab -e 0 12 * * * /usr/bin/certbot renew -q

crontab: invalid option -- 'q'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

This: crontab -e 0 12 * * * -q /usr/bin/certbot renew

crontab: invalid option -- 'q'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

This: crontab -e 0 12 * * * --quiet /usr/bin/certbot renew

crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

This: crontab -e 0 12 * * * /usr/bin/certbot renew

crontab: usage error: no arguments permitted after this option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

I also tried crontab -e 43 6 * * * certbot renew --post-hook "systemctl reload nginx" from this answer, but it threw:

crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)

I don't know what else can I do. I use Ubuntu 20.04.

krystof18
  • 131
  • 4

1 Answers1

3

You want to just run crontab -e and then hit Enter.

Then your crontab will appear in the editor that is configured in your environment.

In the editor, you can then add the line to the crontab that you want to add:

0 12 * * * /usr/bin/certbot renew -quiet

The problem is your trying to do two steps in one.

AllBlooming
  • 146
  • 3