Skip to content

Latest commit

 

History

History
52 lines (32 loc) · 1.94 KB

Scheduling.md

File metadata and controls

52 lines (32 loc) · 1.94 KB

Scheduling

Manually setup cron

Steps:

  1. Copy cron.d/freenom from repo to "/etc/cron.d/freenom"
  2. Edit file to specify domain(s)

Example

0 9 * * 0 root bash -c 'sleep $((RANDOM \% 60))m; /usr/local/bin/freenom.sh -r -a'
0 * * * * root bash -c 'sleep $((RANDOM \% 15))m; /usr/local/bin/freenom.sh -u example.tk'
0 * * * * root bash -c 'sleep $((RANDOM \% 15))m; /usr/local/bin/freenom.sh -u example.tk -s mysubdom'

This first line in this example will run the script with "renew all domains" options every week on Sunday between 9.00 and 10.00

The second line updates the A record of example.tk with the current client ip address, at hourly intervals

Manually setup systemd

Add one or more "timer(s)"

Thanks to @sdcloudt you can use the template units from the systemd dir.

  1. Copy files from repo to: "/lib/systemd/system"

  2. Create a service instance for your domain(s) by creating symlinks (or use systemctl enable, see above)

  3. Reload systemd

Example

# Create symlinks:

mkdir /path/to/systemd/timers.target.wants
ln -s /path/to/systemd/freenom-renew-all.service /etc/systemd/user/timers.target.wants/freenom-renew-all.service
ln -s /path/to/systemd/[email protected] /etc/systemd/user/timers.target.wants/[email protected]:

# (optional) to renew a specific domain, replace freenom-renew-all by:
ln -s /path/to/systemd/[email protected] /etc/systemd/user/timers.target.wants/[email protected]

# then reload systemd:
systemctl daemon-reload

In case of any errors make sure you're using the correct paths and "freenom.conf" is setup. Check systemctl status <unit> and logs.

Note: to use 'user mode' instead of system mode replace "/system" by "/user" and use 'systemctl --user'