A Simple Python Script that reminds one to drink water after every 2 hours from 6am to 10pm or 11 pm
- Twilio Account with a Phone Number
- Python
- Clone the repository and cd into repository
- Create a python virtual environment and install the requirements
python -m venv env_myh20
- Activate the environment
source env_myh20/bin/activate
- Install the requirements
pip install -r requirements.txt
- Create a
.env
file and store you twilio Creds
account_sid='<account_sid>'
auth_token='<auth_token>'
sender_phone_number='<sender_phone_number>' # from twilio
recipient_phone_number='<recipient_phone_number>' # your phone number
- Run the application
python3 main.py
- To Notify you after every 2 hours we use a cronjob
- run in terminal
crontab -e
- Paste the following line into the editor opened
0 */2 6-22 * * <virtual_Environment_Path>/bin/python <File_path>/h2OIntakeReminder/main.py >> <File_path>/h2OIntakeReminder/h2Oreminder_cronjob.log 2>&1
NB
remember to change the File_Path
and virtual_Environment_Path
to your own system path
- Restart the Cronjob service
sudo service cron restart
Email - sammaingi5@gmail.com