Skip to content

Instantly share code, notes, and snippets.

@AhmedHelalAhmed
Last active November 1, 2021 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhmedHelalAhmed/ee7481254c6328fc8ae0f7a592156c9f to your computer and use it in GitHub Desktop.
Save AhmedHelalAhmed/ee7481254c6328fc8ae0f7a592156c9f to your computer and use it in GitHub Desktop.
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