Skip to content

Commit

Permalink
feat: system unit and user unit
Browse files Browse the repository at this point in the history
  • Loading branch information
unknowndevQwQ authored and unknowndevQwQ committed Dec 13, 2023
1 parent 04c3cc0 commit 1b5106e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
systemd units for renew certificates acquired via acme.sh
The timer unit should be enabled.

**Note: User units are not tested**
## How to use

1. `mkdir -pm 0700 /{etc,var/log}/acme.sh`

2. `add LOG_FILE=/var/log/acme.sh/acme.sh.log`

3. `# acme.sh --home /etc/acme.sh command ...[parameters]....`
3. `mv system/* -t /etc/systemd/system` or `mv user/* -t "${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"`
4. `#systemctl enable acme.sh.timer` or `systemctl --user enable acme.sh.timer`
5. `# acme.sh --home /etc/acme.sh command...` or `$ acme.sh command...`
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions user/acme.sh.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=Renew certificates acquired via acme.sh
After=network.target network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
Documentation=https://https://github.com/acmesh-official/acme.sh/wiki

[Service]
# If the version of systemd is 240 or above, then uncommenting Type=simple and commenting out Type=exec
#Type=exec
Type=simple
# The --home argument should be the location of the acme.sh configuration directory.
# This is the user unit, by default there is no need to set the --home folder
#ExecStart=/usr/bin/acme.sh --cron --home %h/.acme.sh
ExecStart=/usr/bin/acme.sh --cron
# acme.sh returns 2 when renewal is skipped (i.e. certs up to date)
SuccessExitStatus=0 2
Restart=on-failure
9 changes: 9 additions & 0 deletions user/acme.sh.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Run acme.sh daily

[Timer]
OnCalendar=*-*-* 00:00:00
Persistent=true

[Install]
WantedBy=timers.target

0 comments on commit 1b5106e

Please sign in to comment.