Skip to content

Shell Script for Monitoring GoogleBot Crawls via Nginx log file and Sending notification to Telegram

License

Notifications You must be signed in to change notification settings

mcnaveen/GoogleBot-Nginx-Telegram-Notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔔 GoogleBot Nginx Telegram Notifier

Get notification on Telegram if GoogleBot visit your website.

💡 How does it work?

Using tail and grep to monitor the nginx log file. Once it matches the word "GoogleBot" it'll immediately send notification to your telegram

🔧 Script Setup

  • Download the GoogleBot.sh file on your linux server in root or home (Home Recommended)

  • Open the file and add these values (Required) (Get Chat ID from here - https://t.me/chatidx_bot)

apiKey= Your Telegram Bot API Key
chatID= Your Chat ID
message="GoogleBot HIT" #You can customize this message
logFile=/var/log/nginx/access.log #Path to your Nginx access log file. (This one is default) 
  • Now, Make it executable chmod +x GoogleBot.sh
  • Next Setup systemd for Running this script continuously
# Navigate to this Directory
cd /etc/systemd/system

# Create New Service File
touch gbotnotify.service

# Create a Service file for systemd service
nano gbotnotify.service
systemctl daemon-reload
systemctl enable gbotnotify
systemctl start gbotnotify
  • You can Check the service status with
systemctl status gbotnotify

☑ LICENSE

MIT


Shoutout

Similar useful bash scripts: