Created
January 12, 2024 12:26
-
-
Save sbryans/7817d740ef7fa6819ee92bd596fdc81d to your computer and use it in GitHub Desktop.
Here's how to get notified in Discord when a Linux process finishes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WEBHOOK="https://discord.com/api/webhooks/" | |
# Replace yes process with your process | |
PID=`ps aux |grep yes |grep -v grep |awk '{print $2}'` | |
while [ "$PID" != "" ] | |
do | |
# Replace yes process with your process | |
PID=`ps aux |grep yes |grep -v grep |awk '{print $2}'` | |
echo "$PID: Active" | |
sleep 2 | |
done | |
# Notify Discord when finished. | |
curl -H "Content-Type: application/json" -d '{"content": "Process Finished."}' $WEBHOOK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment