Server IP : 184.154.167.98 / Your IP : 3.147.45.159 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ddos/ |
Upload File : |
#!/bin/bash # Define the log directory log_dir="/usr/local/cpanel/logs/cpbackup" # Slack webhook details WEBHOOK_URL="https://hooks.slack.com/services/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" USERNAME="Backup_Fail" # Check if the directory exists if [[ -d "$log_dir" ]]; then # Loop through all .log files in the directory for log_file in "$log_dir"/*.log; do # Check if the file exists and is a regular file if [[ -f "$log_file" ]]; then # Capture lines containing "Backups will not run" failed_lines=$(grep "Backups will not run" "$log_file") # If matching lines are found, send to Slack if [[ -n "$failed_lines" ]]; then MESSAGETEXT="Backup issue detected on ${HOSTNAME}. Log file: $log_file. Details:\n$failed_lines\nPlease clear the log once action is taken." JSON="{ \"username\": \"$USERNAME\", \"attachments\": [{\"color\": \"warning\", \"text\": \"$MESSAGETEXT\"}] }" # Send to Slack curl -s -d "payload=$JSON" "$WEBHOOK_URL" fi fi done else echo "Log directory not found: $log_dir" fi