2023-08-12 11:27:29 -04:00
|
|
|
# INSTALL
|
|
|
|
First, clone this repository with the `--recurse-submodules` flag:
|
|
|
|
```
|
|
|
|
$ git clone --recurse-submodules https://git.eldon.me/trey/psi-alerts.git
|
|
|
|
```
|
|
|
|
|
2024-06-09 16:55:04 -04:00
|
|
|
`--recurse-submodules` is only necessary if you wish to use the modified
|
|
|
|
psi-by-example program for `psi-monitor`. I found this too noisy to be of use,
|
|
|
|
it alerts too quickly so I wrote my own with relaxed timing.
|
|
|
|
|
|
|
|
If you want to use the psi-by-example/psi-monitor code, you'll need to compile
|
|
|
|
it:
|
|
|
|
|
|
|
|
```
|
|
|
|
gcc -o psi-monitor psi-monitor.c
|
|
|
|
```
|
|
|
|
|
|
|
|
## Using the systemd template unit
|
|
|
|
1. Copy the `psi-alerts.sh` and `psi-monitor.sh` scripts to */usr/local/bin*:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo cp psi-alerts.sh /usr/local/bin
|
|
|
|
sudo cp psi-monitor.sh /usr/local/bin/psi-monitor
|
|
|
|
### OR ###
|
|
|
|
sudo cp psi-by-example/psi-monitor /usr/local/bin
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Copy the systemd units to */etc/systemd/system*:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo cp psi-alerts@.service psi-monitor.service /etc/systemd/system/
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Using the systemd user units
|
|
|
|
1. Copy the `psi-alerts.sh` and `psi-monitor.sh` scripts to *~/bin* (or
|
|
|
|
wherever you want them):
|
|
|
|
|
|
|
|
```
|
|
|
|
cp -a psi-alerts.sh psi-monitor.sh ~/bin/
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Copy the systemd user units to *~/.config/systemd/user/*
|
|
|
|
|
|
|
|
```
|
|
|
|
cp psi-alerts-user.service ~/.config/systemd/user/psi-alerts.service
|
|
|
|
cp psi-monitor-user.service ~/.config/systemd/user/psi-monitor.service
|
|
|
|
```
|
|
|
|
|
|
|
|
# CONFIGURE
|
|
|
|
See *CONFIGURE.md* in this repository
|
|
|
|
|
|
|
|
# ENABLE and START
|
|
|
|
## system template instance:
|
|
|
|
```
|
|
|
|
sudo systemctl enable --now psi-monitor.service psi-alerts@<user>.service
|
|
|
|
```
|
|
|
|
|
|
|
|
## User instance
|
|
|
|
```
|
|
|
|
systemctl --user enable --now psi-monitor.service psi-alerts.service
|
|
|
|
```
|
2023-08-12 11:27:29 -04:00
|
|
|
|