-
Ensure you have a Twilio Account. If you are a student, Github has a $50 credit for student twilio accounts https://education.github.com/pack
-
register for the free weather API on RapidAPI hub https://rapidapi.com/weatherapi/api/weatherapi-com/
-
install dependiencies:
pip install -r requirements.txt
-
Fill in API key and Twilio API.
-
run main.py with:
python3 main.py
or
chmod +x main.py && ./main.py
-
register main.py to schedule execution
Before execute the command below, be sure to change directory to the path 'main.py' is located
Modify the time and date fields described as * * * * *
echo "* * * * * ${USER}" $(which python3) $(pwd)\/main.py | tee -a /etc/crontab systemctl restart cron.service
The time and date fields:
To run main.py at 09:00 AM everyday
echo "0 9 * * * ${USER}" $(which python3) $(pwd)\/main.py | tee -a /etc/crontab
To run main.py at 02:15 PM on the first of every month:
echo "15 14 1 * * ${USER}" $(which python3) $(pwd)\/main.py | tee -a /etc/crontab
To check if job is scheduled for user (replace username):
sudo crontab -u [username] -l
or if root/dont have root privileges:
less /etc/crontab
Further detail refer https://man7.org/linux/man-pages/man5/crontab.5.html
ghf20 / commuting_weather Goto Github PK
View Code? Open in Web Editor NEWSMS notifications from python as to the optimal time to Commute from destination to source using WeatherAPI and Twilio SMS API. Designed to run from Raspberry Pi
License: MIT License