Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be notified with matrix-commander on a given command execution end #23

Closed
Benjamin-Loison opened this issue Jul 11, 2024 · 3 comments
Closed

Comments

@Benjamin-Loison
Copy link
Owner

Benjamin-Loison commented Jul 11, 2024

ps aux | grep '[r]epo -- sync'
debian      1705  1.3  0.7 860172 502572 pts/0   Sl+  14:05   0:05 /usr/bin/python3 /home/debian/.repo/repo/main.py --repo-dir=/home/debian/.repo --wrapper-version=2.45 --wrapper-path=/home/debian/bin/repo -- sync
...
ps aux | head -n 1
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
@Benjamin-Loison
Copy link
Owner Author

while [ 1 ]
do
    date
    sleep 1
done

has a varying PID.

date
sleep 10
date
tail --pid=PID -f /dev/null; date; matrix-commander -m 'Process finished!'

Source: the Stack Overflow answer 41613532

@Benjamin-Loison
Copy link
Owner Author

Benjamin-Loison commented Jul 11, 2024

 matrix-commander() {
    MESSAGE=`python3 -c "import urllib.parse as ul; print('message=' + ul.quote_plus(\"$1\"))"`
    KEY=CENSORED
    curl -G -s 'https://lemnoslife.com/BEN/notify.php' -d $MESSAGE -d "key=$KEY"
    unset KEY
}
grep -m 1 KEY /var/www/html/BEN/notify.php
matrix-commander 'Process finished!'

@Benjamin-Loison
Copy link
Owner Author

Related to Benjamin-Loison/waydroid/issues/16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant