https://github.com/karthikudyawar/notify
A simple Bash script that runs a command with a logs the output, tracks execution time, and sends optional WhatsApp and desktop notifications upon completion or failure.
https://github.com/karthikudyawar/notify
automation bash desktop-notifications logging notifications notify open-source python scripting ubuntu whatsapp
Last synced: 5 months ago
JSON representation
A simple Bash script that runs a command with a logs the output, tracks execution time, and sends optional WhatsApp and desktop notifications upon completion or failure.
- Host: GitHub
- URL: https://github.com/karthikudyawar/notify
- Owner: KarthikUdyawar
- License: apache-2.0
- Created: 2024-10-20T04:11:28.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-10-21T09:54:48.000Z (12 months ago)
- Last Synced: 2024-10-21T21:33:24.993Z (12 months ago)
- Topics: automation, bash, desktop-notifications, logging, notifications, notify, open-source, python, scripting, ubuntu, whatsapp
- Language: Python
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Notify


[](https://pypi.org/project/pywhatkit/)
[](https://github.com/KarthikUdyawar/notify/blob/master/LICENSE)
[](https://github.com/KarthikUdyawar/notify/stargazers)
[](https://github.com/KarthikUdyawar/notify/network/members)
[](https://github.com/KarthikUdyawar/notify/issues)A simple Bash script that runs a command with a logs the output, tracks execution time, and sends optional WhatsApp and desktop notifications upon completion or failure.
## Table of Contents
- [Notify](#notify)
- [Description](#description)
- [Problem Solved](#problem-solved)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgments](#acknowledgments)
- [Contact Information](#contact-information)## Description
The WhatsApp Notification Script is a Bash-based utility that allows users to execute any command in the terminal while providing real-time notifications via WhatsApp upon completion. It notifies users whether the script executed successfully or failed, and it logs the output of the command to a file. Additionally, it features a loading spinner to enhance the user experience during execution.## Problem Solved
This project solves the problem of monitoring long-running scripts by providing instant feedback through WhatsApp notifications. Users can run their scripts without needing to constantly check the terminal, allowing for more efficient workflow management.[Back to Top](#notify)
## Prerequisites
Before running this project, make sure the following dependencies and software are installed on your system:- **Operating System:** This project is designed to run on Linux-based operating systems (e.g., Ubuntu, Debian). While it may work on other UNIX-like systems, it has not been tested on macOS or Windows.
- **Python 3.x**: You need Python 3 installed on your machine. You can install it using your system's package manager:
```bash
sudo apt-get install python3
```- **libnotify-bin:** This is required for desktop notifications.
```bash
sudo apt-get install libnotify-bin
```
- **Python Development Libraries:** Required to install Python packages properly.```bash
sudo apt-get install python3-dev
```
- **python3-tk:** Required for certain Python packages that rely on graphical libraries.```bash
sudo apt-get install python3-tk
```- **Virtual environment:** Make sure you have Python's virtual environment installed:
```bash
sudo apt-get install python3-venv
```Once you have these prerequisites installed, you can proceed with the installation steps outlined below.
[Back to Top](#notify)
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/KarthikUdyawar/notify.git
cd notify
```2. **Set up a Python virtual environment:**
```bash
python3 -m venv env
source env/bin/activate
```3. **Install required dependencies:** Use the `setup.py` file to install the necessary Python dependencies:
```bash
python3 setup.py install
```4. **Create a .env file:** Copy the `.env/template` to a new `.env` file and update the placeholders:
```bash
cp .env.template .env
```Edit the `.env` file to include your virtual environment path and WhatsApp phone number:
```
# Absolute path to the directory containing the python activate script
VENV_PATH=/home//notify/env/bin/activate# WhatsApp phone number to send notifications to
WHATSAPP_PHONE_NUMBER=+
```5. **Make the script executable:** Run the following command to make the script executable:
```bash
chmod +x run_notify.sh
```6. **Create an alias for easier command execution:**
To simplify running the script, you can create an alias in your shell configuration file (e.g., `.bashrc` or `.zshrc`):- Open your shell configuration file in a text editor. For example, if you are using bash:
```bash
nano ~/.bashrc
```
Or if you are using zsh:
```bash
nano ~/.zshrc
```- Add the following line at the end of the file:
```bash
alias notify='/home//notify/run_notify.sh'
```- Save and close the file. If you are using `nano`, you can do this by pressing `CTRL + X`, then `Y` to confirm changes, and `ENTER` to exit.
- After adding the alias, run the following command to apply the changes:
```bash
source ~/.bashrc
```
Or for zsh:
```bash
source ~/.zshrc
```
[Back to Top](#notify)## Usage
To run a command and receive notifications, use the following syntax:
```bash
notify [--notify-whatsapp]
```### Example
```bash
notify --notify-whatsapp python3 example/mock_huge_task.py
```- `--notify-whatsapp`: Optional flag to enable WhatsApp notifications.
- ``: The command you want to execute.[Back to Top](#notify)
## Contributing
Contributions are welcome! To contribute to this project:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature/YourFeature`).
3. Make your changes.
4. Commit your changes (`git commit -m 'Add some feature'`).
5. Push to the branch (`git push origin feature/YourFeature`).
6. Open a pull request.Please ensure that your code adheres to the project's coding style and that you have tested your changes.
## License
This project is licensed under the Apache License. See the [LICENSE](https://github.com/KarthikUdyawar/notify/blob/master/LICENSE) file for details.## Acknowledgments
- **Inspiration:** Special thanks to all open-source contributors and communities that inspire and support developers around the world.
- **Libraries and Tools:** This project uses several libraries and tools that enhance its functionality, including:
- [pywhatkit](https://github.com/Ankit404butfound/pywhatkit) for sending WhatsApp messages.
- [libnotify](https://gitlab.gnome.org/GNOME/libnotify) for desktop notifications.
- **Community:** Thanks to the programming and developer community for their invaluable resources, tutorials, and documentation that helped make this project possible.## Contact Information
For support or questions, please reach out to:- GitHub Profile: [KarthikUdyawar](https://github.com/KarthikUdyawar)
[Back to Top](#notify)