This repository contains the code to run a bash script that sends you a Telegram message remembering to expose the correct waste bin for the following day city waste collection.
Telegram notificationsFollowing the Udine collection calendar for the 2022, the city collections happens in this days:
Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | |
---|---|---|---|---|---|---|---|
Circ. 1 | 🟤 | ⚫️⚪️ | 🟡 🔵 | 🟤 | 🟢 | ⚫️⚪️ | |
Circ. 2 | 🟤⚪️ | 🔵 | 🟡 | ⚫️⚪️ | 🟤 | 🟢* | |
Circ. 3 | 🟤⚪️ | 🔵 | 🟡 | 🟤 | ⚫️⚪️ | 🟢* | |
Circ. 4 | 🟤⚪️ | 🔵 | 🟡 | ⚫️⚪️ | 🟤 | 🟢* | |
Circ. 5 | 🟤⚪️ | 🔵 | 🟡 | ⚫️⚪️ | 🟤 | 🟢* | |
Circ. 6 | 🟤⚪️ | 🔵 | 🟡 | ⚫️⚪️ | 🟤 | 🟢* | |
Circ. 7 | 🟤⚪️ | 🔵 | 🟡 | 🟤 | ⚫️⚪️ | 🟢* |
where
- 🔵 represents the paper packagings collection;
- 🟡 represents the plastic packagings collection;
- 🟤 represents the organic waste collection;
- ⚫️ represents the undifferentiate collection;
- ⚪️ represents the diapers collection;
- 🟢 represents the glass and jar collection.
In order to successfully run the code, you only need curl
installed on your system.
First of all, clone in you home folder (or wherever you like in your system) the project folder from the GitHub repository.
cd ~ # Navigate to the place where you want the project folder to be
git clone enstit/wastecollection_reminder
Note If you don't know how to create a Telegram bot using BotFather, read the official guide.
After creating the Telegram bot, save your BOT_TOKEN
and GROUP_ID
.
After cloning this repository, and once insite its directory, make your copy of the config
file
cp config.ini.example config.ini
and edit it with your chosen values for the variables.
nano config.ini
Monday
: the waste bin that is being collected each Monday;Tuesday
: the waste bin that is being collected each Tuesday;- ...
Saturday
: the waste bin that is being collected each Saturday.
If multiple bins are being collected in a single day, place them into an array.
BOT_TOKEN
: yout Telegram API token to send the notifications with the bot you created previously;GROUP_ID
: the Telgram bot chat ID.
Enter the crontab configuration file
crontab -l > mycron # write out current crontab
echo "<MINUTE> <HOUR> * * * /bin/sh <PATH TO THE PROJECT FOLDER>/send_wastecollection_notify.sh" >> mycron # echo new cron into cron file
crontab mycron # install new cron file
rm mycron # remove temporary file
changin MINUTE
to the minute of the HOUR
, and HOUR
to the 24-format hour you want to receive the notification. So for example, if you want to be notified each day at 7pm the day before the city collection, simply run
crontab -l > mycron
echo "00 19 * * * /bin/sh <PATH TO THE PROJECT FOLDER>/send_wastecollection_notify.sh" >> mycron
crontab mycron && rm mycron
And you're done!