As process-watcher
does not seem to be maintained anymore, I decided to create process-alert
.
process-alert
is a basic python program to get alerted when a process is finished.
Contrary to process-watcher
you can only monitor one program at a time, otherwise this program would be way more complex with many more async
coroutines and await
operations. To monitor many programs, just launch it as many times as you need.
python3 -m venv venv_process_alert
git clone https://github.com/remyd1/process-alert.git
source venv_process_alert/bin/activate
cd process-alert
python3 -m pip install -r requirements.txt
source venv_process_alert/bin/activate
cd process-alert
python3 process_cli.py --help
python3 process_cli.py process_name name geany
You will be alerted when geany program will be finished with a desktop notification.
# to be alerted for PID 11111 to be finished
python3 process_cli.py process_pid num 11111
Get alerted with email:
python3 process_cli.py process_name name geany --email-to [email protected]
You can add as many email you want, by adding --email-to [email protected]
...
Copy and edit the configuration file:
cp config/process-alert.conf.sample config/process-alert.conf
vim config/process-alert.conf
Enter configuration option for your Matrix room, server URL; you also need a token to post messages.
See here on how to retrieve your user token.
Then, to get alerted with Matrix (need matrix_
values in the configuration file config/process-alert.conf
):
python3 process_cli.py process_name name geany --notifymethod matrix
Setup is a bit more simple as Matrix because you only need to create a Mattermost webhook. Then, add your Mattermost webhook URL to your configuration file config/process-alert.conf
.
You can use this program without any argument by using process.py
instead of process_cli.py
. Your configuration file config/process-alert.conf
will need to all the required informations.
source venv_process_alert/bin/activate
cd process-alert
python3 process.py
Config file are checked in the following order:
config/process-alert.conf
,~/.config/process-alert.conf
,/etc/process-alert/process-alert.conf
.