This project fetches real-time temperature data for a specified city (default: Karachi) and displays desktop notifications. The setup.sh
script will automatically install dependencies and compile the C program.
- Fetch real-time weather data for any city.
- Display desktop notifications with the current temperature.
- Automated setup with a single command.
- Linux Environment
- Internet Connection
- OpenWeatherMap API Key
-
Clone the Repository:
git clone https://github.com/assamirzafar/C-Weather-project.git cd C-Weather-project
-
Run the Setup Script:
sudo ./setup.sh
The script will:
- Install required dependencies (
libcurl
,libjson-c
). - Compile the C program (
monitor_env.c
).
- Install required dependencies (
-
Run the Monitoring Script:
./monitor_env.sh
You can set up a cron job to run the script automatically at regular intervals (e.g., every minute):
-
Open the Crontab Editor:
crontab -e
-
Add the Following Line:
* * * * * cd /path/to/C-Weather-project && ./monitor_env.sh >> /path/to/C-Weather-project/cron.log 2>&1
-
Save and Exit:
- Press
Ctrl + X
, thenY
, andEnter
.
- Press
This will:
- Run the
monitor_env.sh
script every minute. - Log the output to
cron.log
.
- Change City: Edit the
CITY
macro inmonitor_env.c
. - API Key: Replace the
you-api-key-here
with your OpenWeatherMap API key.
This project is open-source under the MIT License. Feel free to contribute!
Enjoy real-time weather updates! ☀️