Skip to content

Instantly share code, notes, and snippets.

@AhmedHelalAhmed
Last active Nov 1, 2021
Embed
What would you like to do?
log notification
  • 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
#!/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
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