- Make new file in /usr/local/bin with name log add its content from the file with name log
- Add execution ability to it by: sudo chmod +x log
- Add the song file with name new_log.mp3 in /usr/local/bin
- Open terminal in for example laravel project(example-app): log /var/www/html/example-app/storage/logs/laravel.log
Last active
November 1, 2021 21:47
-
-
Save AhmedHelalAhmed/ee7481254c6328fc8ae0f7a592156c9f to your computer and use it in GitHub Desktop.
log notification
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 | |
filePath="$1" | |
curr=$(<"$filePath") | |
inotifywait -m -e modify -r "$filePath" --format "%e" | while read -r event; do | |
if [ "$event" == "MODIFY" ]; then | |
prev="$curr" | |
curr=$(<"$filePath") | |
[ "$curr" == "$prev" ] || notify-send "Some error"; play "/usr/local/bin/new_log.mp3" | |
fi | |
done |
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
sudo apt-get install inotify-tools | |
sudo apt-get install sox libsox-fmt-mp3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment