https://github.com/101t/psql-email-alert
PostgreSQL Email Alerts
https://github.com/101t/psql-email-alert
cronjob email-alert gorilla plpython postgresql
Last synced: 5 months ago
JSON representation
PostgreSQL Email Alerts
- Host: GitHub
- URL: https://github.com/101t/psql-email-alert
- Owner: 101t
- Created: 2019-12-24T06:27:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-04T09:34:47.000Z (over 5 years ago)
- Last Synced: 2024-12-31T04:13:29.732Z (7 months ago)
- Topics: cronjob, email-alert, gorilla, plpython, postgresql
- Language: TSQL
- Size: 3.52 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gorilla
This is an example of Email alert using PostgreSQL with PL/Python inside.
## Instructions:
1. Download the script into Ubuntu Server `git clone https://github.com/101t/psql-email-alert /opt`, then Install `PL/Python` and `PostgreSQL`.
2. Connect to postgresql `sudo -u postgres psql`
3. create database called `gorilladb`:```sql
create database gorilladb;
grant all privileges on database gorilladb to postgres;
\q
```4. instal pl/python, run the following command:
```sh
sudo apt-get install -y postgresql-plpython3-*
```
then go to gorilladb and type run:
```sql
CREATE OR REPLACE LANGUAGE plpython3u;
```5. you can run script in `/opt/psql-email-alert/main.sh`
6. copy and append `gorilla.cron` script into `nano /etc/crontab` then:
```sh
cat /opt/psql-email-alert/gorilla.cron >> /etc/crontab # please don't do this twice
```
7. check the mail cron in terminal using:
```sh
systemctl status cron
systemctl restart cron
```