import monthlyReminder from 'https://cdn.skypack.dev/monthly-reminder';
Set a recurring reminder on a specific day of the month. If the date falls on a weekend, the alarm (actually it's an email 😅) will go off on the next weekday (or the previous weekday if you choose so).
After installing you need to add an entry to your crontab that will execute monthly-reminder daily.
And to do that, we need to know the absolute path of monthly-reminder.
gt; which monthly-reminder
gt; ls -l /usr/bin/monthly-reminder
lrwxrwxrwx 1 root root 56 Mar 22 10:48 /usr/bin/monthly-reminder -> ../lib/node_modules/monthly-reminder/monthly-reminder.js
Now we have all the information we need. Run crontab -e and schedule a daily job:
gt; crontab -e
# Make sure that you are setting the hour in your server's timezone.
# You can choose a different hour to receive the emails but the program must run daily.
0 9 * * * /usr/bin/monthly-reminder exec
You need to create a config.json in the monthly-reminder directory. We found that directory in the previous step:
Let's change the directory:
gt; cd /usr/lib/node_modules/monthly-reminder
There is an example config that you can copy and derive. config.json content should be like this:
monthly-reminder uses Nodemailer to send emails. The nodemailer
object in the config is passed to createTransport of Nodemailer without modification. You may need additional
settings to send emails from your email provider. You can find all available configuration keys in Nodemailer
All available commands are listed in the general help section: