Server IP : 184.154.167.98 / Your IP : 18.220.32.12 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 : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /sbin/ |
Upload File : |
#!/bin/bash # Function to send Slack notification send_slack_notification() { SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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" SLACK_CHANNEL="#backups" # Replace with your actual channel name USERNAME="${HOSTNAME}_Reseller_Account_Backup" MESSAGE="$1" JSON="{ \"username\":\"$USERNAME\", \"channel\":\"$SLACK_CHANNEL\", \"attachments\":[{\"color\":\"warning\" , \"text\": \"$MESSAGE\"}]}" # curl -s -d "payload=$JSON" "$SLACK_WEBHOOK_URL" } # Prompt for reseller name echo "Please provide Reseller account name: " read username # Store reseller name in a file echo "Reseller name is $username" grep $username /etc/trueuserowners | cut -d':' -f1 > /usr/local/ddos/reseller_users.txt # Create a folder for the reseller mkdir -p /home/whwteam/reseller_$username # Send Slack notification: backup started send_slack_notification "Reseller backup has started for $username." # Function to run the backup process run_backup() { # Loop through each user and run the backup command while IFS= read -r user; do /scripts/pkgacct $user mv /home/cpmove-$user.tar.gz /home/whwteam/reseller_$username/ done < /usr/local/ddos/reseller_users.txt # Send Slack notification: backup completed send_slack_notification "Reseller backup has completed for $username. Please terminate the accounts from WHM and add notes in billing." # Clean up the temporary file rm -f /usr/local/ddos/reseller_users.txt } # Run the backup in the background and redirect output to a log file (run_backup &)